home *** CD-ROM | disk | FTP | other *** search
MacBinary | 1988-08-02 | 25.9 KB | [TEXT/MPS ] |
open in:
MacOS 8.1
|
Win98
|
DOS
view JSON data
|
view as text
This file was processed as: MacBinary
(archive/macBinary).
You can browse this item here: Sample.c
Confidence | Program | Detection | Match Type | Support
|
---|
66%
| dexvert
| Compact Compressed (Unix) (archive/compact)
| ext
| Supported |
10%
| dexvert
| MacBinary (archive/macBinary)
| fallback
| Supported |
1%
| dexvert
| Text File (text/txt)
| fallback
| Supported |
100%
| file
| MacBinary II, inited, Mon Aug 1 23:55:59 1988, modified Mon Aug 1 23:55:59 1988, creator 'MPS ', type ASCII, 25526 bytes "Sample.c" , at 0x6436 650 bytes resource
| default (weak)
| |
99%
| file
| data
| default
| |
74%
| TrID
| Macintosh plain text (MacBinary)
| default
| |
25%
| TrID
| MacBinary 2
| default (weak)
| |
100%
| siegfried
| fmt/1762 MacBinary (II)
| default
| |
100%
| lsar
| MacBinary
| default
|
|
id metadata |
---|
key | value |
---|
macFileType | [TEXT] |
macFileCreator | [MPS ] |
hex view+--------+-------------------------+-------------------------+--------+--------+
|00000000| 00 08 53 61 6d 70 6c 65 | 2e 63 00 00 00 00 00 00 |..Sample|.c......|
|00000010| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000040| 00 54 45 58 54 4d 50 53 | 20 01 00 00 00 00 00 00 |.TEXTMPS| .......|
|00000050| 00 00 00 00 00 63 b6 00 | 00 02 8a 9f 1a ed cf 9f |.....c..|........|
|00000060| 1a ed cf 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000070| 00 00 00 00 00 00 00 00 | 00 00 81 81 e7 d3 00 00 |........|........|
|00000080| 2f 2a 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |/*------|--------|
|00000090| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000000a0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000000b0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000000c0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000000d0| 0d 23 0d 23 09 41 70 70 | 6c 65 20 4d 61 63 69 6e |.#.#.App|le Macin|
|000000e0| 74 6f 73 68 20 44 65 76 | 65 6c 6f 70 65 72 20 54 |tosh Dev|eloper T|
|000000f0| 65 63 68 6e 69 63 61 6c | 20 53 75 70 70 6f 72 74 |echnical| Support|
|00000100| 0d 23 0d 23 09 4d 75 6c | 74 69 46 69 6e 64 65 72 |.#.#.Mul|tiFinder|
|00000110| 2d 41 77 61 72 65 20 53 | 69 6d 70 6c 65 20 53 61 |-Aware S|imple Sa|
|00000120| 6d 70 6c 65 20 41 70 70 | 6c 69 63 61 74 69 6f 6e |mple App|lication|
|00000130| 0d 23 0d 23 09 53 61 6d | 70 6c 65 0d 23 0d 23 09 |.#.#.Sam|ple.#.#.|
|00000140| 53 61 6d 70 6c 65 2e 63 | 09 2d 09 43 20 53 6f 75 |Sample.c|.-.C Sou|
|00000150| 72 63 65 0d 23 0d 23 09 | 43 6f 70 79 72 69 67 68 |rce.#.#.|Copyrigh|
|00000160| 74 20 a9 20 31 39 38 38 | 20 41 70 70 6c 65 20 43 |t . 1988| Apple C|
|00000170| 6f 6d 70 75 74 65 72 2c | 20 49 6e 63 2e 0d 23 09 |omputer,| Inc..#.|
|00000180| 41 6c 6c 20 72 69 67 68 | 74 73 20 72 65 73 65 72 |All righ|ts reser|
|00000190| 76 65 64 2e 0d 23 0d 23 | 09 56 65 72 73 69 6f 6e |ved..#.#|.Version|
|000001a0| 73 3a 09 31 2e 30 09 09 | 09 09 09 38 2f 38 38 0d |s:.1.0..|...8/88.|
|000001b0| 23 0d 23 09 43 6f 6d 70 | 6f 6e 65 6e 74 73 3a 09 |#.#.Comp|onents:.|
|000001c0| 53 61 6d 70 6c 65 2e 70 | 09 09 09 41 75 67 75 73 |Sample.p|...Augus|
|000001d0| 74 20 31 2c 20 31 39 38 | 38 0d 23 09 09 09 09 53 |t 1, 198|8.#....S|
|000001e0| 61 6d 70 6c 65 2e 63 09 | 09 09 41 75 67 75 73 74 |ample.c.|..August|
|000001f0| 20 31 2c 20 31 39 38 38 | 0d 23 09 09 09 09 53 61 | 1, 1988|.#....Sa|
|00000200| 6d 70 6c 65 2e 72 09 09 | 09 41 75 67 75 73 74 20 |mple.r..|.August |
|00000210| 31 2c 20 31 39 38 38 0d | 23 09 09 09 09 53 61 6d |1, 1988.|#....Sam|
|00000220| 70 6c 65 2e 68 09 09 09 | 41 75 67 75 73 74 20 31 |ple.h...|August 1|
|00000230| 2c 20 31 39 38 38 0d 23 | 09 09 09 09 50 53 61 6d |, 1988.#|....PSam|
|00000240| 70 6c 65 2e 6d 61 6b 65 | 09 09 41 75 67 75 73 74 |ple.make|..August|
|00000250| 20 31 2c 20 31 39 38 38 | 0d 23 09 09 09 09 43 53 | 1, 1988|.#....CS|
|00000260| 61 6d 70 6c 65 2e 6d 61 | 6b 65 09 09 41 75 67 75 |ample.ma|ke..Augu|
|00000270| 73 74 20 31 2c 20 31 39 | 38 38 0d 23 0d 23 09 53 |st 1, 19|88.#.#.S|
|00000280| 61 6d 70 6c 65 20 69 73 | 20 61 6e 20 65 78 61 6d |ample is| an exam|
|00000290| 70 6c 65 20 61 70 70 6c | 69 63 61 74 69 6f 6e 20 |ple appl|ication |
|000002a0| 74 68 61 74 20 64 65 6d | 6f 6e 73 74 72 61 74 65 |that dem|onstrate|
|000002b0| 73 20 68 6f 77 20 74 6f | 0d 23 09 69 6e 69 74 69 |s how to|.#.initi|
|000002c0| 61 6c 69 7a 65 20 74 68 | 65 20 63 6f 6d 6d 6f 6e |alize th|e common|
|000002d0| 6c 79 20 75 73 65 64 20 | 74 6f 6f 6c 62 6f 78 20 |ly used |toolbox |
|000002e0| 6d 61 6e 61 67 65 72 73 | 2c 20 6f 70 65 72 61 74 |managers|, operat|
|000002f0| 65 20 0d 23 09 73 75 63 | 63 65 73 73 66 75 6c 6c |e .#.suc|cessfull|
|00000300| 79 20 75 6e 64 65 72 20 | 4d 75 6c 74 69 46 69 6e |y under |MultiFin|
|00000310| 64 65 72 2c 20 68 61 6e | 64 6c 65 20 64 65 73 6b |der, han|dle desk|
|00000320| 20 61 63 63 65 73 73 6f | 72 69 65 73 2c 20 0d 23 | accesso|ries, .#|
|00000330| 09 61 6e 64 20 63 72 65 | 61 74 65 2c 20 67 72 6f |.and cre|ate, gro|
|00000340| 77 2c 20 61 6e 64 20 7a | 6f 6f 6d 20 77 69 6e 64 |w, and z|oom wind|
|00000350| 6f 77 73 2e 0d 23 0d 23 | 09 49 74 20 64 6f 65 73 |ows..#.#|.It does|
|00000360| 20 6e 6f 74 20 62 79 20 | 61 6e 79 20 6d 65 61 6e | not by |any mean|
|00000370| 73 20 64 65 6d 6f 6e 73 | 74 72 61 74 65 20 61 6c |s demons|trate al|
|00000380| 6c 20 74 68 65 20 74 65 | 63 68 6e 69 71 75 65 73 |l the te|chniques|
|00000390| 20 0d 23 09 79 6f 75 20 | 6e 65 65 64 20 66 6f 72 | .#.you |need for|
|000003a0| 20 61 20 6c 61 72 67 65 | 20 61 70 70 6c 69 63 61 | a large| applica|
|000003b0| 74 69 6f 6e 2e 20 49 6e | 20 70 61 72 74 69 63 75 |tion. In| particu|
|000003c0| 6c 61 72 2c 20 53 61 6d | 70 6c 65 20 0d 23 09 64 |lar, Sam|ple .#.d|
|000003d0| 6f 65 73 20 6e 6f 74 20 | 63 6f 76 65 72 20 65 78 |oes not |cover ex|
|000003e0| 63 65 70 74 69 6f 6e 20 | 68 61 6e 64 6c 69 6e 67 |ception |handling|
|000003f0| 2c 20 6d 75 6c 74 69 70 | 6c 65 20 77 69 6e 64 6f |, multip|le windo|
|00000400| 77 73 2f 64 6f 63 75 6d | 65 6e 74 73 2c 20 0d 23 |ws/docum|ents, .#|
|00000410| 09 73 6f 70 68 69 73 74 | 69 63 61 74 65 64 20 6d |.sophist|icated m|
|00000420| 65 6d 6f 72 79 20 6d 61 | 6e 61 67 65 6d 65 6e 74 |emory ma|nagement|
|00000430| 2c 20 70 72 69 6e 74 69 | 6e 67 2c 20 6f 72 20 75 |, printi|ng, or u|
|00000440| 6e 64 6f 2e 20 41 6c 6c | 20 6f 66 20 0d 23 09 74 |ndo. All| of .#.t|
|00000450| 68 65 73 65 20 61 72 65 | 20 76 69 74 61 6c 20 70 |hese are| vital p|
|00000460| 61 72 74 73 20 6f 66 20 | 61 20 6e 6f 72 6d 61 6c |arts of |a normal|
|00000470| 20 66 75 6c 6c 2d 73 69 | 7a 65 64 20 61 70 70 6c | full-si|zed appl|
|00000480| 69 63 61 74 69 6f 6e 2e | 0d 23 0d 23 09 54 68 69 |ication.|.#.#.Thi|
|00000490| 73 20 61 70 70 6c 69 63 | 61 74 69 6f 6e 20 69 73 |s applic|ation is|
|000004a0| 20 61 6e 20 65 78 61 6d | 70 6c 65 20 6f 66 20 74 | an exam|ple of t|
|000004b0| 68 65 20 66 6f 72 6d 20 | 6f 66 20 61 20 4d 61 63 |he form |of a Mac|
|000004c0| 69 6e 74 6f 73 68 20 0d | 23 09 61 70 70 6c 69 63 |intosh .|#.applic|
|000004d0| 61 74 69 6f 6e 3b 20 69 | 74 20 69 73 20 4e 4f 54 |ation; i|t is NOT|
|000004e0| 20 61 20 74 65 6d 70 6c | 61 74 65 2e 20 49 74 20 | a templ|ate. It |
|000004f0| 69 73 20 4e 4f 54 20 69 | 6e 74 65 6e 64 65 64 20 |is NOT i|ntended |
|00000500| 74 6f 20 62 65 20 0d 23 | 09 75 73 65 64 20 61 73 |to be .#|.used as|
|00000510| 20 61 20 66 6f 75 6e 64 | 61 74 69 6f 6e 20 66 6f | a found|ation fo|
|00000520| 72 20 74 68 65 20 6e 65 | 78 74 20 77 6f 72 6c 64 |r the ne|xt world|
|00000530| 2d 63 6c 61 73 73 2c 20 | 62 65 73 74 2d 73 65 6c |-class, |best-sel|
|00000540| 6c 69 6e 67 2c 20 0d 23 | 09 36 30 30 4b 20 61 70 |ling, .#|.600K ap|
|00000550| 70 6c 69 63 61 74 69 6f | 6e 2e 20 41 20 73 74 69 |plicatio|n. A sti|
|00000560| 63 6b 20 66 69 67 75 72 | 65 20 64 72 61 77 69 6e |ck figur|e drawin|
|00000570| 67 20 6f 66 20 74 68 65 | 20 68 75 6d 61 6e 20 62 |g of the| human b|
|00000580| 6f 64 79 20 6d 61 79 20 | 0d 23 09 62 65 20 61 20 |ody may |.#.be a |
|00000590| 67 6f 6f 64 20 65 78 61 | 6d 70 6c 65 20 6f 66 20 |good exa|mple of |
|000005a0| 74 68 65 20 66 6f 72 6d | 20 66 6f 72 20 61 20 70 |the form| for a p|
|000005b0| 61 69 6e 74 69 6e 67 2c | 20 62 75 74 20 74 68 61 |ainting,| but tha|
|000005c0| 74 20 64 6f 65 73 20 6e | 6f 74 20 0d 23 09 6d 65 |t does n|ot .#.me|
|000005d0| 61 6e 20 69 74 20 73 68 | 6f 75 6c 64 20 62 65 20 |an it sh|ould be |
|000005e0| 75 73 65 64 20 61 73 20 | 74 68 65 20 62 61 73 69 |used as |the basi|
|000005f0| 73 20 66 6f 72 20 74 68 | 65 20 6e 65 78 74 20 4d |s for th|e next M|
|00000600| 6f 6e 61 20 4c 69 73 61 | 2e 0d 23 0d 23 09 57 65 |ona Lisa|..#.#.We|
|00000610| 20 72 65 63 6f 6d 6d 65 | 6e 64 20 74 68 61 74 20 | recomme|nd that |
|00000620| 79 6f 75 20 72 65 76 69 | 65 77 20 74 68 69 73 20 |you revi|ew this |
|00000630| 70 72 6f 67 72 61 6d 20 | 6f 72 20 54 45 53 61 6d |program |or TESam|
|00000640| 70 6c 65 20 62 65 66 6f | 72 65 20 0d 23 09 62 65 |ple befo|re .#.be|
|00000650| 67 69 6e 6e 69 6e 67 20 | 61 20 6e 65 77 20 61 70 |ginning |a new ap|
|00000660| 70 6c 69 63 61 74 69 6f | 6e 2e 0d 23 0d 2d 2d 2d |plicatio|n..#.---|
|00000670| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00000680| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00000690| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000006a0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000006b0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2a 2f 0d 0d 0d |--------|---*/...|
|000006c0| 2f 2a 20 53 65 67 6d 65 | 6e 74 61 74 69 6f 6e 20 |/* Segme|ntation |
|000006d0| 73 74 72 61 74 65 67 79 | 3a 0d 0d 20 20 20 54 68 |strategy|:.. Th|
|000006e0| 69 73 20 70 72 6f 67 72 | 61 6d 20 63 6f 6e 73 69 |is progr|am consi|
|000006f0| 73 74 73 20 6f 66 20 74 | 68 72 65 65 20 73 65 67 |sts of t|hree seg|
|00000700| 6d 65 6e 74 73 2e 20 4d | 61 69 6e 20 63 6f 6e 74 |ments. M|ain cont|
|00000710| 61 69 6e 73 20 6d 6f 73 | 74 20 6f 66 20 74 68 65 |ains mos|t of the|
|00000720| 20 63 6f 64 65 2c 0d 20 | 20 20 69 6e 63 6c 75 64 | code,. | includ|
|00000730| 69 6e 67 20 74 68 65 20 | 4d 50 57 20 6c 69 62 72 |ing the |MPW libr|
|00000740| 61 72 69 65 73 2c 20 61 | 6e 64 20 74 68 65 20 6d |aries, a|nd the m|
|00000750| 61 69 6e 20 70 72 6f 67 | 72 61 6d 2e 20 49 6e 69 |ain prog|ram. Ini|
|00000760| 74 69 61 6c 69 7a 65 20 | 63 6f 6e 74 61 69 6e 73 |tialize |contains|
|00000770| 0d 20 20 20 63 6f 64 65 | 20 74 68 61 74 20 69 73 |. code| that is|
|00000780| 20 6f 6e 6c 79 20 75 73 | 65 64 20 6f 6e 63 65 2c | only us|ed once,|
|00000790| 20 64 75 72 69 6e 67 20 | 73 74 61 72 74 75 70 2c | during |startup,|
|000007a0| 20 61 6e 64 20 63 61 6e | 20 62 65 20 75 6e 6c 6f | and can| be unlo|
|000007b0| 61 64 65 64 20 61 66 74 | 65 72 20 74 68 65 0d 20 |aded aft|er the. |
|000007c0| 20 20 70 72 6f 67 72 61 | 6d 20 73 74 61 72 74 73 | progra|m starts|
|000007d0| 2e 20 25 41 35 49 6e 69 | 74 20 69 73 20 61 75 74 |. %A5Ini|t is aut|
|000007e0| 6f 6d 61 74 69 63 61 6c | 6c 79 20 63 72 65 61 74 |omatical|ly creat|
|000007f0| 65 64 20 62 79 20 74 68 | 65 20 4c 69 6e 6b 65 72 |ed by th|e Linker|
|00000800| 20 74 6f 20 69 6e 69 74 | 69 61 6c 69 7a 65 0d 20 | to init|ialize. |
|00000810| 20 20 67 6c 6f 62 61 6c | 73 20 66 6f 72 20 74 68 | global|s for th|
|00000820| 65 20 4d 50 57 20 6c 69 | 62 72 61 72 69 65 73 20 |e MPW li|braries |
|00000830| 61 6e 64 20 69 73 20 75 | 6e 6c 6f 61 64 65 64 20 |and is u|nloaded |
|00000840| 72 69 67 68 74 20 61 77 | 61 79 2e 20 2a 2f 0d 0d |right aw|ay. */..|
|00000850| 0d 2f 2a 20 53 65 74 50 | 6f 72 74 20 73 74 72 61 |./* SetP|ort stra|
|00000860| 74 65 67 79 3a 0d 0d 20 | 20 20 54 6f 6f 6c 62 6f |tegy:.. | Toolbo|
|00000870| 78 20 72 6f 75 74 69 6e | 65 73 20 64 6f 20 6e 6f |x routin|es do no|
|00000880| 74 20 63 68 61 6e 67 65 | 20 74 68 65 20 63 75 72 |t change| the cur|
|00000890| 72 65 6e 74 20 70 6f 72 | 74 2e 20 49 6e 20 73 70 |rent por|t. In sp|
|000008a0| 69 74 65 20 6f 66 20 74 | 68 69 73 2c 20 69 6e 20 |ite of t|his, in |
|000008b0| 74 68 69 73 0d 20 20 20 | 70 72 6f 67 72 61 6d 20 |this. |program |
|000008c0| 77 65 20 75 73 65 20 61 | 20 73 74 72 61 74 65 67 |we use a| strateg|
|000008d0| 79 20 6f 66 20 63 61 6c | 6c 69 6e 67 20 53 65 74 |y of cal|ling Set|
|000008e0| 50 6f 72 74 20 77 68 65 | 6e 65 76 65 72 20 77 65 |Port whe|never we|
|000008f0| 20 77 61 6e 74 20 74 6f | 20 64 72 61 77 20 6f 72 | want to| draw or|
|00000900| 0d 20 20 20 6d 61 6b 65 | 20 63 61 6c 6c 73 20 77 |. make| calls w|
|00000910| 68 69 63 68 20 64 65 70 | 65 6e 64 20 6f 6e 20 74 |hich dep|end on t|
|00000920| 68 65 20 63 75 72 72 65 | 6e 74 20 70 6f 72 74 2e |he curre|nt port.|
|00000930| 20 54 68 69 73 20 6d 61 | 6b 65 73 20 75 73 20 6c | This ma|kes us l|
|00000940| 65 73 73 20 76 75 6c 6e | 65 72 61 62 6c 65 0d 20 |ess vuln|erable. |
|00000950| 20 20 74 6f 20 62 75 67 | 73 20 69 6e 20 6f 74 68 | to bug|s in oth|
|00000960| 65 72 20 73 6f 66 74 77 | 61 72 65 20 77 68 69 63 |er softw|are whic|
|00000970| 68 20 6d 69 67 68 74 20 | 61 6c 74 65 72 20 74 68 |h might |alter th|
|00000980| 65 20 63 75 72 72 65 6e | 74 20 70 6f 72 74 20 28 |e curren|t port (|
|00000990| 73 75 63 68 20 61 73 20 | 74 68 65 0d 20 20 20 62 |such as |the. b|
|000009a0| 75 67 20 28 66 65 61 74 | 75 72 65 3f 29 20 69 6e |ug (feat|ure?) in|
|000009b0| 20 6d 61 6e 79 20 64 65 | 73 6b 20 61 63 63 65 73 | many de|sk acces|
|000009c0| 73 6f 72 69 65 73 20 77 | 68 69 63 68 20 63 68 61 |sories w|hich cha|
|000009d0| 6e 67 65 20 74 68 65 20 | 70 6f 72 74 20 6f 6e 20 |nge the |port on |
|000009e0| 4f 70 65 6e 44 65 73 6b | 41 63 63 29 2e 0d 20 20 |OpenDesk|Acc).. |
|000009f0| 20 48 6f 70 65 66 75 6c | 6c 79 2c 20 74 68 69 73 | Hopeful|ly, this|
|00000a00| 20 61 6c 73 6f 20 6d 61 | 6b 65 73 20 74 68 65 20 | also ma|kes the |
|00000a10| 72 6f 75 74 69 6e 65 73 | 20 66 72 6f 6d 20 74 68 |routines| from th|
|00000a20| 69 73 20 70 72 6f 67 72 | 61 6d 20 6d 6f 72 65 20 |is progr|am more |
|00000a30| 73 65 6c 66 2d 63 6f 6e | 74 61 69 6e 65 64 2c 0d |self-con|tained,.|
|00000a40| 20 20 20 73 69 6e 63 65 | 20 74 68 65 79 20 64 6f | since| they do|
|00000a50| 6e 27 74 20 64 65 70 65 | 6e 64 20 6f 6e 20 74 68 |n't depe|nd on th|
|00000a60| 65 20 63 75 72 72 65 6e | 74 20 70 6f 72 74 20 73 |e curren|t port s|
|00000a70| 65 74 74 69 6e 67 2e 20 | 2a 2f 0d 0d 0d 23 69 6e |etting. |*/...#in|
|00000a80| 63 6c 75 64 65 20 3c 56 | 61 6c 75 65 73 2e 68 3e |clude <V|alues.h>|
|00000a90| 0d 23 69 6e 63 6c 75 64 | 65 20 3c 54 79 70 65 73 |.#includ|e <Types|
|00000aa0| 2e 68 3e 0d 23 69 6e 63 | 6c 75 64 65 20 3c 52 65 |.h>.#inc|lude <Re|
|00000ab0| 73 6f 75 72 63 65 73 2e | 68 3e 0d 23 69 6e 63 6c |sources.|h>.#incl|
|00000ac0| 75 64 65 20 3c 51 75 69 | 63 6b 44 72 61 77 2e 68 |ude <Qui|ckDraw.h|
|00000ad0| 3e 0d 23 69 6e 63 6c 75 | 64 65 20 3c 46 6f 6e 74 |>.#inclu|de <Font|
|00000ae0| 73 2e 68 3e 0d 23 69 6e | 63 6c 75 64 65 20 3c 45 |s.h>.#in|clude <E|
|00000af0| 76 65 6e 74 73 2e 68 3e | 0d 23 69 6e 63 6c 75 64 |vents.h>|.#includ|
|00000b00| 65 20 3c 57 69 6e 64 6f | 77 73 2e 68 3e 0d 23 69 |e <Windo|ws.h>.#i|
|00000b10| 6e 63 6c 75 64 65 20 3c | 4d 65 6e 75 73 2e 68 3e |nclude <|Menus.h>|
|00000b20| 0d 23 69 6e 63 6c 75 64 | 65 20 3c 54 65 78 74 45 |.#includ|e <TextE|
|00000b30| 64 69 74 2e 68 3e 0d 23 | 69 6e 63 6c 75 64 65 20 |dit.h>.#|include |
|00000b40| 3c 44 69 61 6c 6f 67 73 | 2e 68 3e 0d 23 69 6e 63 |<Dialogs|.h>.#inc|
|00000b50| 6c 75 64 65 20 3c 44 65 | 73 6b 2e 68 3e 0d 23 69 |lude <De|sk.h>.#i|
|00000b60| 6e 63 6c 75 64 65 20 3c | 54 6f 6f 6c 55 74 69 6c |nclude <|ToolUtil|
|00000b70| 73 2e 68 3e 0d 23 69 6e | 63 6c 75 64 65 20 3c 4d |s.h>.#in|clude <M|
|00000b80| 65 6d 6f 72 79 2e 68 3e | 0d 23 69 6e 63 6c 75 64 |emory.h>|.#includ|
|00000b90| 65 20 3c 53 65 67 4c 6f | 61 64 2e 68 3e 0d 23 69 |e <SegLo|ad.h>.#i|
|00000ba0| 6e 63 6c 75 64 65 20 3c | 46 69 6c 65 73 2e 68 3e |nclude <|Files.h>|
|00000bb0| 0d 23 69 6e 63 6c 75 64 | 65 20 3c 4f 53 55 74 69 |.#includ|e <OSUti|
|00000bc0| 6c 73 2e 68 3e 0d 23 69 | 6e 63 6c 75 64 65 20 3c |ls.h>.#i|nclude <|
|00000bd0| 54 72 61 70 73 2e 68 3e | 09 09 2f 2a 20 4d 50 57 |Traps.h>|../* MPW|
|00000be0| 20 32 2e 30 2e 32 20 54 | 72 61 70 73 2e 68 20 69 | 2.0.2 T|raps.h i|
|00000bf0| 73 20 6d 69 73 73 69 6e | 67 20 61 6e 20 23 65 6e |s missin|g an #en|
|00000c00| 64 69 66 20 2a 2f 0d 23 | 69 6e 63 6c 75 64 65 20 |dif */.#|include |
|00000c10| 3c 53 61 6d 70 6c 65 2e | 68 3e 09 09 2f 2a 20 62 |<Sample.|h>../* b|
|00000c20| 72 69 6e 67 20 69 6e 20 | 61 6c 6c 20 74 68 65 20 |ring in |all the |
|00000c30| 23 64 65 66 69 6e 65 73 | 20 66 6f 72 20 53 61 6d |#defines| for Sam|
|00000c40| 70 6c 65 20 2a 2f 0d 0d | 0d 2f 2a 20 54 68 65 20 |ple */..|./* The |
|00000c50| 22 67 22 20 70 72 65 66 | 69 78 20 69 73 20 75 73 |"g" pref|ix is us|
|00000c60| 65 64 20 74 6f 20 65 6d | 70 68 61 73 69 7a 65 20 |ed to em|phasize |
|00000c70| 74 68 61 74 20 61 20 76 | 61 72 69 61 62 6c 65 20 |that a v|ariable |
|00000c80| 69 73 20 67 6c 6f 62 61 | 6c 2e 20 2a 2f 0d 0d 2f |is globa|l. */../|
|00000c90| 2a 20 47 4d 61 63 20 69 | 73 20 75 73 65 64 20 74 |* GMac i|s used t|
|00000ca0| 6f 20 68 6f 6c 64 20 74 | 68 65 20 72 65 73 75 6c |o hold t|he resul|
|00000cb0| 74 20 6f 66 20 61 20 53 | 79 73 45 6e 76 69 72 6f |t of a S|ysEnviro|
|00000cc0| 6e 73 20 63 61 6c 6c 2e | 20 54 68 69 73 20 6d 61 |ns call.| This ma|
|00000cd0| 6b 65 73 0d 20 20 20 69 | 74 20 63 6f 6e 76 65 6e |kes. i|t conven|
|00000ce0| 69 65 6e 74 20 66 6f 72 | 20 61 6e 79 20 72 6f 75 |ient for| any rou|
|00000cf0| 74 69 6e 65 20 74 6f 20 | 63 68 65 63 6b 20 74 68 |tine to |check th|
|00000d00| 65 20 65 6e 76 69 72 6f | 6e 6d 65 6e 74 2e 20 2a |e enviro|nment. *|
|00000d10| 2f 0d 53 79 73 45 6e 76 | 52 65 63 09 67 4d 61 63 |/.SysEnv|Rec.gMac|
|00000d20| 3b 09 09 09 09 2f 2a 20 | 73 65 74 20 75 70 20 62 |;..../* |set up b|
|00000d30| 79 20 49 6e 69 74 69 61 | 6c 69 7a 65 20 2a 2f 0d |y Initia|lize */.|
|00000d40| 0d 2f 2a 20 47 48 61 73 | 57 61 69 74 4e 65 78 74 |./* GHas|WaitNext|
|00000d50| 45 76 65 6e 74 20 69 73 | 20 73 65 74 20 61 74 20 |Event is| set at |
|00000d60| 73 74 61 72 74 75 70 2c | 20 61 6e 64 20 74 65 6c |startup,| and tel|
|00000d70| 6c 73 20 77 68 65 74 68 | 65 72 20 74 68 65 20 57 |ls wheth|er the W|
|00000d80| 61 69 74 4e 65 78 74 45 | 76 65 6e 74 0d 20 20 20 |aitNextE|vent. |
|00000d90| 74 72 61 70 20 69 73 20 | 61 76 61 69 6c 61 62 6c |trap is |availabl|
|00000da0| 65 2e 20 49 66 20 69 74 | 20 69 73 20 66 61 6c 73 |e. If it| is fals|
|00000db0| 65 2c 20 77 65 20 6b 6e | 6f 77 20 74 68 61 74 20 |e, we kn|ow that |
|00000dc0| 77 65 20 6d 75 73 74 20 | 63 61 6c 6c 20 47 65 74 |we must |call Get|
|00000dd0| 4e 65 78 74 45 76 65 6e | 74 2e 20 2a 2f 0d 42 6f |NextEven|t. */.Bo|
|00000de0| 6f 6c 65 61 6e 09 09 67 | 48 61 73 57 61 69 74 4e |olean..g|HasWaitN|
|00000df0| 65 78 74 45 76 65 6e 74 | 3b 09 2f 2a 20 73 65 74 |extEvent|;./* set|
|00000e00| 20 75 70 20 62 79 20 49 | 6e 69 74 69 61 6c 69 7a | up by I|nitializ|
|00000e10| 65 20 2a 2f 0d 0d 2f 2a | 20 47 49 6e 42 61 63 6b |e */../*| GInBack|
|00000e20| 67 72 6f 75 6e 64 20 69 | 73 20 6d 61 69 6e 74 61 |ground i|s mainta|
|00000e30| 69 6e 65 64 20 62 79 20 | 6f 75 72 20 6f 73 45 76 |ined by |our osEv|
|00000e40| 65 6e 74 20 68 61 6e 64 | 6c 69 6e 67 20 72 6f 75 |ent hand|ling rou|
|00000e50| 74 69 6e 65 73 2e 20 41 | 6e 79 20 70 61 72 74 20 |tines. A|ny part |
|00000e60| 6f 66 0d 20 20 20 74 68 | 65 20 70 72 6f 67 72 61 |of. th|e progra|
|00000e70| 6d 20 63 61 6e 20 63 68 | 65 63 6b 20 69 74 20 74 |m can ch|eck it t|
|00000e80| 6f 20 66 69 6e 64 20 6f | 75 74 20 69 66 20 69 74 |o find o|ut if it|
|00000e90| 20 69 73 20 63 75 72 72 | 65 6e 74 6c 79 20 69 6e | is curr|ently in|
|00000ea0| 20 74 68 65 20 62 61 63 | 6b 67 72 6f 75 6e 64 2e | the bac|kground.|
|00000eb0| 20 2a 2f 0d 42 6f 6f 6c | 65 61 6e 09 09 67 49 6e | */.Bool|ean..gIn|
|00000ec0| 42 61 63 6b 67 72 6f 75 | 6e 64 3b 09 09 2f 2a 20 |Backgrou|nd;../* |
|00000ed0| 6d 61 69 6e 74 61 69 6e | 65 64 20 62 79 20 49 6e |maintain|ed by In|
|00000ee0| 69 74 69 61 6c 69 7a 65 | 20 61 6e 64 20 44 6f 45 |itialize| and DoE|
|00000ef0| 76 65 6e 74 20 2a 2f 0d | 0d 0d 2f 2a 20 54 68 65 |vent */.|../* The|
|00000f00| 20 66 6f 6c 6c 6f 77 69 | 6e 67 20 67 6c 6f 62 61 | followi|ng globa|
|00000f10| 6c 73 20 61 72 65 20 74 | 68 65 20 73 74 61 74 65 |ls are t|he state|
|00000f20| 20 6f 66 20 74 68 65 20 | 77 69 6e 64 6f 77 2e 20 | of the |window. |
|00000f30| 49 66 20 77 65 20 73 75 | 70 70 6f 72 74 65 64 20 |If we su|pported |
|00000f40| 6d 6f 72 65 20 74 68 61 | 6e 0d 20 20 20 6f 6e 65 |more tha|n. one|
|00000f50| 20 77 69 6e 64 6f 77 2c | 20 74 68 65 79 20 77 6f | window,| they wo|
|00000f60| 75 6c 64 20 62 65 20 61 | 74 74 61 74 63 68 65 64 |uld be a|ttatched|
|00000f70| 20 74 6f 20 65 61 63 68 | 20 64 6f 63 75 6d 65 6e | to each| documen|
|00000f80| 74 2c 20 72 61 74 68 65 | 72 20 74 68 61 6e 20 67 |t, rathe|r than g|
|00000f90| 6c 6f 62 61 6c 73 2e 20 | 2a 2f 0d 0d 2f 2a 20 47 |lobals. |*/../* G|
|00000fa0| 53 74 6f 70 70 65 64 20 | 74 65 6c 6c 73 20 77 68 |Stopped |tells wh|
|00000fb0| 65 74 68 65 72 20 74 68 | 65 20 73 74 6f 70 20 6c |ether th|e stop l|
|00000fc0| 69 67 68 74 20 69 73 20 | 63 75 72 72 65 6e 74 6c |ight is |currentl|
|00000fd0| 79 20 6f 6e 20 73 74 6f | 70 20 6f 72 20 67 6f 2e |y on sto|p or go.|
|00000fe0| 20 2a 2f 0d 42 6f 6f 6c | 65 61 6e 09 09 67 53 74 | */.Bool|ean..gSt|
|00000ff0| 6f 70 70 65 64 3b 09 09 | 09 2f 2a 20 6d 61 69 6e |opped;..|./* main|
|00001000| 74 61 69 6e 65 64 20 62 | 79 20 49 6e 69 74 69 61 |tained b|y Initia|
|00001010| 6c 69 7a 65 20 61 6e 64 | 20 53 65 74 4c 69 67 68 |lize and| SetLigh|
|00001020| 74 20 2a 2f 0d 0d 2f 2a | 20 47 53 74 6f 70 52 65 |t */../*| GStopRe|
|00001030| 63 74 20 61 6e 64 20 67 | 47 6f 52 65 63 74 20 61 |ct and g|GoRect a|
|00001040| 72 65 20 74 68 65 20 72 | 65 63 74 61 6e 67 6c 65 |re the r|ectangle|
|00001050| 73 20 6f 66 20 74 68 65 | 20 74 77 6f 20 73 74 6f |s of the| two sto|
|00001060| 70 20 6c 69 67 68 74 73 | 20 69 6e 20 74 68 65 20 |p lights| in the |
|00001070| 77 69 6e 64 6f 77 2e 20 | 2a 2f 0d 52 65 63 74 09 |window. |*/.Rect.|
|00001080| 09 67 53 74 6f 70 52 65 | 63 74 3b 09 09 09 2f 2a |.gStopRe|ct;.../*|
|00001090| 20 73 65 74 20 75 70 20 | 62 79 20 49 6e 69 74 69 | set up |by Initi|
|000010a0| 61 6c 69 7a 65 20 2a 2f | 0d 52 65 63 74 09 09 67 |alize */|.Rect..g|
|000010b0| 47 6f 52 65 63 74 3b 09 | 09 09 2f 2a 20 73 65 74 |GoRect;.|../* set|
|000010c0| 20 75 70 20 62 79 20 49 | 6e 69 74 69 61 6c 69 7a | up by I|nitializ|
|000010d0| 65 20 2a 2f 0d 0d 0d 2f | 2a 20 48 65 72 65 20 61 |e */.../|* Here a|
|000010e0| 72 65 20 64 65 63 6c 61 | 72 61 74 69 6f 6e 73 20 |re decla|rations |
|000010f0| 66 6f 72 20 61 6c 6c 20 | 6f 66 20 74 68 65 20 43 |for all |of the C|
|00001100| 20 72 6f 75 74 69 6e 65 | 73 2e 20 49 6e 20 4d 50 | routine|s. In MP|
|00001110| 57 20 33 2e 30 20 77 65 | 20 63 61 6e 20 75 73 65 |W 3.0 we| can use|
|00001120| 0d 20 20 20 61 63 74 75 | 61 6c 20 70 72 6f 74 6f |. actu|al proto|
|00001130| 74 79 70 65 73 20 66 6f | 72 20 70 61 72 61 6d 65 |types fo|r parame|
|00001140| 74 65 72 20 74 79 70 65 | 20 63 68 65 63 6b 69 6e |ter type| checkin|
|00001150| 67 2e 20 2a 2f 0d 23 69 | 66 6e 64 65 66 20 4d 50 |g. */.#i|fndef MP|
|00001160| 57 33 0d 09 76 6f 69 64 | 20 45 76 65 6e 74 4c 6f |W3..void| EventLo|
|00001170| 6f 70 28 29 3b 0d 09 76 | 6f 69 64 20 44 6f 45 76 |op();..v|oid DoEv|
|00001180| 65 6e 74 28 20 2f 2a 20 | 45 76 65 6e 74 52 65 63 |ent( /* |EventRec|
|00001190| 6f 72 64 20 2a 65 76 65 | 6e 74 20 2a 2f 20 29 3b |ord *eve|nt */ );|
|000011a0| 0d 09 76 6f 69 64 20 41 | 64 6a 75 73 74 43 75 72 |..void A|djustCur|
|000011b0| 73 6f 72 28 20 2f 2a 20 | 50 6f 69 6e 74 20 6d 6f |sor( /* |Point mo|
|000011c0| 75 73 65 2c 20 52 67 6e | 48 61 6e 64 6c 65 20 72 |use, Rgn|Handle r|
|000011d0| 65 67 69 6f 6e 20 2a 2f | 20 29 3b 0d 09 76 6f 69 |egion */| );..voi|
|000011e0| 64 20 44 6f 55 70 64 61 | 74 65 28 20 2f 2a 20 57 |d DoUpda|te( /* W|
|000011f0| 69 6e 64 6f 77 50 74 72 | 20 77 69 6e 64 6f 77 20 |indowPtr| window |
|00001200| 2a 2f 20 29 3b 0d 09 76 | 6f 69 64 20 44 6f 41 63 |*/ );..v|oid DoAc|
|00001210| 74 69 76 61 74 65 28 20 | 2f 2a 20 57 69 6e 64 6f |tivate( |/* Windo|
|00001220| 77 50 74 72 20 77 69 6e | 64 6f 77 2c 20 42 6f 6f |wPtr win|dow, Boo|
|00001230| 6c 65 61 6e 20 62 65 63 | 6f 6d 69 6e 67 41 63 74 |lean bec|omingAct|
|00001240| 69 76 65 20 2a 2f 20 29 | 3b 0d 09 76 6f 69 64 20 |ive */ )|;..void |
|00001250| 44 6f 43 6f 6e 74 65 6e | 74 43 6c 69 63 6b 28 20 |DoConten|tClick( |
|00001260| 2f 2a 20 57 69 6e 64 6f | 77 50 74 72 20 77 69 6e |/* Windo|wPtr win|
|00001270| 64 6f 77 20 2a 2f 20 29 | 3b 0d 09 76 6f 69 64 20 |dow */ )|;..void |
|00001280| 44 72 61 77 57 69 6e 64 | 6f 77 28 20 2f 2a 20 57 |DrawWind|ow( /* W|
|00001290| 69 6e 64 6f 77 50 74 72 | 20 77 69 6e 64 6f 77 20 |indowPtr| window |
|000012a0| 2a 2f 20 29 3b 0d 09 76 | 6f 69 64 20 41 64 6a 75 |*/ );..v|oid Adju|
|000012b0| 73 74 4d 65 6e 75 73 28 | 29 3b 0d 09 76 6f 69 64 |stMenus(|);..void|
|000012c0| 20 44 6f 4d 65 6e 75 43 | 6f 6d 6d 61 6e 64 28 20 | DoMenuC|ommand( |
|000012d0| 2f 2a 20 6c 6f 6e 67 20 | 6d 65 6e 75 52 65 73 75 |/* long |menuResu|
|000012e0| 6c 74 20 2a 2f 20 29 3b | 0d 09 76 6f 69 64 20 53 |lt */ );|..void S|
|000012f0| 65 74 4c 69 67 68 74 28 | 20 2f 2a 20 57 69 6e 64 |etLight(| /* Wind|
|00001300| 6f 77 50 74 72 20 77 69 | 6e 64 6f 77 2c 20 42 6f |owPtr wi|ndow, Bo|
|00001310| 6f 6c 65 61 6e 20 6e 65 | 77 53 74 6f 70 70 65 64 |olean ne|wStopped|
|00001320| 20 2a 2f 20 29 3b 0d 09 | 76 6f 69 64 20 44 6f 43 | */ );..|void DoC|
|00001330| 6c 6f 73 65 57 69 6e 64 | 6f 77 28 20 2f 2a 20 57 |loseWind|ow( /* W|
|00001340| 69 6e 64 6f 77 50 74 72 | 20 77 69 6e 64 6f 77 20 |indowPtr| window |
|00001350| 2a 2f 20 29 3b 0d 09 76 | 6f 69 64 20 44 6f 43 6c |*/ );..v|oid DoCl|
|00001360| 6f 73 65 42 65 68 69 6e | 64 28 20 2f 2a 20 57 69 |oseBehin|d( /* Wi|
|00001370| 6e 64 6f 77 50 74 72 20 | 77 69 6e 64 6f 77 20 2a |ndowPtr |window *|
|00001380| 2f 20 29 3b 0d 09 76 6f | 69 64 20 54 65 72 6d 69 |/ );..vo|id Termi|
|00001390| 6e 61 74 65 28 29 3b 0d | 09 76 6f 69 64 20 49 6e |nate();.|.void In|
|000013a0| 69 74 69 61 6c 69 7a 65 | 28 29 3b 0d 09 76 6f 69 |itialize|();..voi|
|000013b0| 64 20 47 6f 47 65 74 52 | 65 63 74 28 20 2f 2a 20 |d GoGetR|ect( /* |
|000013c0| 73 68 6f 72 74 20 72 65 | 63 74 49 44 2c 20 52 65 |short re|ctID, Re|
|000013d0| 63 74 20 2a 74 68 65 52 | 65 63 74 20 2a 2f 20 29 |ct *theR|ect */ )|
|000013e0| 3b 0d 09 76 6f 69 64 20 | 46 6f 72 63 65 45 6e 76 |;..void |ForceEnv|
|000013f0| 69 72 6f 6e 73 28 29 3b | 0d 09 42 6f 6f 6c 65 61 |irons();|..Boolea|
|00001400| 6e 20 49 73 41 70 70 57 | 69 6e 64 6f 77 28 20 2f |n IsAppW|indow( /|
|00001410| 2a 20 57 69 6e 64 6f 77 | 50 74 72 20 77 69 6e 64 |* Window|Ptr wind|
|00001420| 6f 77 20 2a 2f 20 29 3b | 0d 09 42 6f 6f 6c 65 61 |ow */ );|..Boolea|
|00001430| 6e 20 49 73 44 41 57 69 | 6e 64 6f 77 28 20 2f 2a |n IsDAWi|ndow( /*|
|00001440| 20 57 69 6e 64 6f 77 50 | 74 72 20 77 69 6e 64 6f | WindowP|tr windo|
|00001450| 77 20 2a 2f 20 29 3b 0d | 09 42 6f 6f 6c 65 61 6e |w */ );.|.Boolean|
|00001460| 20 54 72 61 70 41 76 61 | 69 6c 61 62 6c 65 28 20 | TrapAva|ilable( |
|00001470| 2f 2a 20 73 68 6f 72 74 | 20 74 4e 75 6d 62 65 72 |/* short| tNumber|
|00001480| 2c 20 54 72 61 70 54 79 | 70 65 20 74 54 79 70 65 |, TrapTy|pe tType|
|00001490| 20 2a 2f 20 29 3b 0d 23 | 65 6c 73 65 0d 09 76 6f | */ );.#|else..vo|
|000014a0| 69 64 20 45 76 65 6e 74 | 4c 6f 6f 70 28 20 76 6f |id Event|Loop( vo|
|000014b0| 69 64 20 29 3b 0d 09 76 | 6f 69 64 20 44 6f 45 76 |id );..v|oid DoEv|
|000014c0| 65 6e 74 28 20 45 76 65 | 6e 74 52 65 63 6f 72 64 |ent( Eve|ntRecord|
|000014d0| 20 2a 65 76 65 6e 74 20 | 29 3b 0d 09 76 6f 69 64 | *event |);..void|
|000014e0| 20 41 64 6a 75 73 74 43 | 75 72 73 6f 72 28 20 50 | AdjustC|ursor( P|
|000014f0| 6f 69 6e 74 20 6d 6f 75 | 73 65 2c 20 52 67 6e 48 |oint mou|se, RgnH|
|00001500| 61 6e 64 6c 65 20 72 65 | 67 69 6f 6e 20 29 3b 0d |andle re|gion );.|
|00001510| 09 76 6f 69 64 20 44 6f | 55 70 64 61 74 65 28 20 |.void Do|Update( |
|00001520| 57 69 6e 64 6f 77 50 74 | 72 20 77 69 6e 64 6f 77 |WindowPt|r window|
|00001530| 20 29 3b 0d 09 76 6f 69 | 64 20 44 6f 41 63 74 69 | );..voi|d DoActi|
|00001540| 76 61 74 65 28 20 57 69 | 6e 64 6f 77 50 74 72 20 |vate( Wi|ndowPtr |
|00001550| 77 69 6e 64 6f 77 2c 20 | 42 6f 6f 6c 65 61 6e 20 |window, |Boolean |
|00001560| 62 65 63 6f 6d 69 6e 67 | 41 63 74 69 76 65 20 29 |becoming|Active )|
|00001570| 3b 0d 09 76 6f 69 64 20 | 44 6f 43 6f 6e 74 65 6e |;..void |DoConten|
|00001580| 74 43 6c 69 63 6b 28 20 | 57 69 6e 64 6f 77 50 74 |tClick( |WindowPt|
|00001590| 72 20 77 69 6e 64 6f 77 | 20 29 3b 0d 09 76 6f 69 |r window| );..voi|
|000015a0| 64 20 44 72 61 77 57 69 | 6e 64 6f 77 28 20 57 69 |d DrawWi|ndow( Wi|
|000015b0| 6e 64 6f 77 50 74 72 20 | 77 69 6e 64 6f 77 20 29 |ndowPtr |window )|
|000015c0| 3b 0d 09 76 6f 69 64 20 | 41 64 6a 75 73 74 4d 65 |;..void |AdjustMe|
|000015d0| 6e 75 73 28 20 76 6f 69 | 64 20 29 3b 0d 09 76 6f |nus( voi|d );..vo|
|000015e0| 69 64 20 44 6f 4d 65 6e | 75 43 6f 6d 6d 61 6e 64 |id DoMen|uCommand|
|000015f0| 28 20 6c 6f 6e 67 20 6d | 65 6e 75 52 65 73 75 6c |( long m|enuResul|
|00001600| 74 20 29 3b 0d 09 76 6f | 69 64 20 53 65 74 4c 69 |t );..vo|id SetLi|
|00001610| 67 68 74 28 20 57 69 6e | 64 6f 77 50 74 72 20 77 |ght( Win|dowPtr w|
|00001620| 69 6e 64 6f 77 2c 20 42 | 6f 6f 6c 65 61 6e 20 6e |indow, B|oolean n|
|00001630| 65 77 53 74 6f 70 70 65 | 64 20 29 3b 0d 09 76 6f |ewStoppe|d );..vo|
|00001640| 69 64 20 44 6f 43 6c 6f | 73 65 57 69 6e 64 6f 77 |id DoClo|seWindow|
|00001650| 28 20 57 69 6e 64 6f 77 | 50 74 72 20 77 69 6e 64 |( Window|Ptr wind|
|00001660| 6f 77 20 29 3b 0d 09 76 | 6f 69 64 20 44 6f 43 6c |ow );..v|oid DoCl|
|00001670| 6f 73 65 42 65 68 69 6e | 64 28 20 57 69 6e 64 6f |oseBehin|d( Windo|
|00001680| 77 50 74 72 20 77 69 6e | 64 6f 77 20 29 3b 0d 09 |wPtr win|dow );..|
|00001690| 76 6f 69 64 20 54 65 72 | 6d 69 6e 61 74 65 28 20 |void Ter|minate( |
|000016a0| 76 6f 69 64 20 29 3b 0d | 09 76 6f 69 64 20 49 6e |void );.|.void In|
|000016b0| 69 74 69 61 6c 69 7a 65 | 28 20 76 6f 69 64 20 29 |itialize|( void )|
|000016c0| 3b 0d 09 76 6f 69 64 20 | 47 6f 47 65 74 52 65 63 |;..void |GoGetRec|
|000016d0| 74 28 20 73 68 6f 72 74 | 20 72 65 63 74 49 44 2c |t( short| rectID,|
|000016e0| 20 52 65 63 74 20 2a 74 | 68 65 52 65 63 74 20 29 | Rect *t|heRect )|
|000016f0| 3b 0d 09 76 6f 69 64 20 | 46 6f 72 63 65 45 6e 76 |;..void |ForceEnv|
|00001700| 69 72 6f 6e 73 28 20 76 | 6f 69 64 20 29 3b 0d 09 |irons( v|oid );..|
|00001710| 42 6f 6f 6c 65 61 6e 20 | 49 73 41 70 70 57 69 6e |Boolean |IsAppWin|
|00001720| 64 6f 77 28 20 57 69 6e | 64 6f 77 50 74 72 20 77 |dow( Win|dowPtr w|
|00001730| 69 6e 64 6f 77 20 29 3b | 0d 09 42 6f 6f 6c 65 61 |indow );|..Boolea|
|00001740| 6e 20 49 73 44 41 57 69 | 6e 64 6f 77 28 20 57 69 |n IsDAWi|ndow( Wi|
|00001750| 6e 64 6f 77 50 74 72 20 | 77 69 6e 64 6f 77 20 29 |ndowPtr |window )|
|00001760| 3b 0d 09 42 6f 6f 6c 65 | 61 6e 20 54 72 61 70 41 |;..Boole|an TrapA|
|00001770| 76 61 69 6c 61 62 6c 65 | 28 20 73 68 6f 72 74 20 |vailable|( short |
|00001780| 74 4e 75 6d 62 65 72 2c | 20 54 72 61 70 54 79 70 |tNumber,| TrapTyp|
|00001790| 65 20 74 54 79 70 65 20 | 29 3b 0d 23 65 6e 64 69 |e tType |);.#endi|
|000017a0| 66 0d 0d 0d 2f 2a 20 4d | 61 6b 65 20 74 68 65 20 |f.../* M|ake the |
|000017b0| 32 2e 30 20 49 6e 74 65 | 72 66 61 63 65 20 66 6f |2.0 Inte|rface fo|
|000017c0| 72 20 70 61 73 73 69 6e | 67 20 50 6f 69 6e 74 73 |r passin|g Points|
|000017d0| 20 74 6f 20 74 68 65 20 | 54 6f 6f 6c 62 6f 78 20 | to the |Toolbox |
|000017e0| 62 79 20 61 64 64 72 65 | 73 73 2c 0d 20 20 20 65 |by addre|ss,. e|
|000017f0| 6d 75 6c 61 74 65 20 74 | 68 65 20 33 2e 30 20 6d |mulate t|he 3.0 m|
|00001800| 65 74 68 6f 64 20 6f 66 | 20 70 61 73 73 69 6e 67 |ethod of| passing|
|00001810| 20 50 6f 69 6e 74 73 20 | 62 79 20 76 61 6c 75 65 | Points |by value|
|00001820| 2e 20 54 68 69 73 20 6c | 69 73 74 20 6f 6e 6c 79 |. This l|ist only|
|00001830| 20 63 6f 6e 74 61 69 6e | 73 0d 20 20 20 74 68 65 | contain|s. the|
|00001840| 20 61 66 66 65 63 74 65 | 64 20 72 6f 75 74 69 6e | affecte|d routin|
|00001850| 65 73 20 61 63 74 75 61 | 6c 6c 79 20 75 73 65 64 |es actua|lly used|
|00001860| 20 69 6e 20 74 68 69 73 | 20 73 61 6d 70 6c 65 2c | in this| sample,|
|00001870| 20 61 6e 64 20 69 73 20 | 6e 6f 74 20 69 6e 74 65 | and is |not inte|
|00001880| 6e 64 65 64 20 74 6f 0d | 20 20 20 62 65 20 61 20 |nded to.| be a |
|00001890| 63 6f 6d 70 72 65 68 65 | 6e 73 69 76 65 20 6c 69 |comprehe|nsive li|
|000018a0| 73 74 20 6f 66 20 74 68 | 65 20 61 66 66 65 63 74 |st of th|e affect|
|000018b0| 65 64 20 72 6f 75 74 69 | 6e 65 73 2e 0d 0d 20 20 |ed routi|nes... |
|000018c0| 20 46 6f 72 20 72 6f 75 | 74 69 6e 65 73 20 74 68 | For rou|tines th|
|000018d0| 61 74 20 68 61 76 65 20 | 53 74 72 32 35 35 20 66 |at have |Str255 f|
|000018e0| 6f 72 6d 61 6c 20 70 61 | 72 61 6d 65 74 65 72 73 |ormal pa|rameters|
|000018f0| 20 77 65 20 63 61 6e 6e | 6f 74 20 64 6f 20 61 20 | we cann|ot do a |
|00001900| 73 69 6d 69 6c 61 72 20 | 74 72 69 63 6b 0d 20 20 |similar |trick. |
|00001910| 20 73 6f 20 74 68 65 20 | 6e 65 63 65 73 73 61 72 | so the |necessar|
|00001920| 79 20 63 68 61 6e 67 65 | 73 20 61 72 65 20 69 6e |y change|s are in|
|00001930| 20 74 68 65 20 63 6f 64 | 65 20 69 74 73 65 6c 66 | the cod|e itself|
|00001940| 2e 20 53 65 61 72 63 68 | 69 6e 67 20 66 6f 72 20 |. Search|ing for |
|00001950| 4d 50 57 33 20 77 69 6c | 6c 20 66 69 6e 64 0d 20 |MPW3 wil|l find. |
|00001960| 20 20 74 68 65 6d 2e 20 | 2a 2f 0d 23 69 66 6e 64 | them. |*/.#ifnd|
|00001970| 65 66 20 4d 50 57 33 0d | 23 09 64 65 66 69 6e 65 |ef MPW3.|#.define|
|00001980| 20 46 69 6e 64 57 69 6e | 64 6f 77 09 46 49 4e 44 | FindWin|dow.FIND|
|00001990| 57 49 4e 44 4f 57 0d 23 | 09 64 65 66 69 6e 65 20 |WINDOW.#|.define |
|000019a0| 4d 65 6e 75 53 65 6c 65 | 63 74 09 4d 45 4e 55 53 |MenuSele|ct.MENUS|
|000019b0| 45 4c 45 43 54 0d 23 09 | 64 65 66 69 6e 65 20 44 |ELECT.#.|define D|
|000019c0| 72 61 67 57 69 6e 64 6f | 77 09 44 52 41 47 57 49 |ragWindo|w.DRAGWI|
|000019d0| 4e 44 4f 57 0d 23 09 64 | 65 66 69 6e 65 20 47 72 |NDOW.#.d|efine Gr|
|000019e0| 6f 77 57 69 6e 64 6f 77 | 09 47 52 4f 57 57 49 4e |owWindow|.GROWWIN|
|000019f0| 44 4f 57 0d 23 09 64 65 | 66 69 6e 65 20 54 72 61 |DOW.#.de|fine Tra|
|00001a00| 63 6b 42 6f 78 09 09 54 | 52 41 43 4b 42 4f 58 0d |ckBox..T|RACKBOX.|
|00001a10| 23 09 64 65 66 69 6e 65 | 20 50 74 49 6e 52 67 6e |#.define| PtInRgn|
|00001a20| 09 09 50 54 49 4e 52 47 | 4e 0d 23 65 6e 64 69 66 |..PTINRG|N.#endif|
|00001a30| 0d 0d 2f 2a 20 44 65 66 | 69 6e 65 20 48 69 57 72 |../* Def|ine HiWr|
|00001a40| 64 20 61 6e 64 20 4c 6f | 57 72 64 20 6d 61 63 72 |d and Lo|Wrd macr|
|00001a50| 6f 73 20 66 6f 72 20 65 | 66 66 69 63 69 65 6e 63 |os for e|fficienc|
|00001a60| 79 2e 20 2a 2f 0d 23 64 | 65 66 69 6e 65 20 48 69 |y. */.#d|efine Hi|
|00001a70| 57 72 64 28 61 4c 6f 6e | 67 29 09 28 28 28 61 4c |Wrd(aLon|g).(((aL|
|00001a80| 6f 6e 67 29 20 3e 3e 20 | 31 36 29 20 26 20 30 78 |ong) >> |16) & 0x|
|00001a90| 46 46 46 46 29 0d 23 64 | 65 66 69 6e 65 20 4c 6f |FFFF).#d|efine Lo|
|00001aa0| 57 72 64 28 61 4c 6f 6e | 67 29 09 28 28 61 4c 6f |Wrd(aLon|g).((aLo|
|00001ab0| 6e 67 29 20 26 20 30 78 | 46 46 46 46 29 0d 0d 2f |ng) & 0x|FFFF)../|
|00001ac0| 2a 20 44 65 66 69 6e 65 | 20 54 6f 70 4c 65 66 74 |* Define| TopLeft|
|00001ad0| 20 61 6e 64 20 42 6f 74 | 52 69 67 68 74 20 6d 61 | and Bot|Right ma|
|00001ae0| 63 72 6f 73 20 66 6f 72 | 20 63 6f 6e 76 65 6e 69 |cros for| conveni|
|00001af0| 65 6e 63 65 2e 20 4e 6f | 74 69 63 65 20 74 68 65 |ence. No|tice the|
|00001b00| 20 69 6d 70 6c 69 63 69 | 74 0d 20 20 20 64 65 70 | implici|t. dep|
|00001b10| 65 6e 64 65 6e 63 79 20 | 6f 6e 20 74 68 65 20 6f |endency |on the o|
|00001b20| 72 64 65 72 69 6e 67 20 | 6f 66 20 66 69 65 6c 64 |rdering |of field|
|00001b30| 73 20 77 69 74 68 69 6e | 20 61 20 52 65 63 74 20 |s within| a Rect |
|00001b40| 2a 2f 0d 23 64 65 66 69 | 6e 65 20 54 6f 70 4c 65 |*/.#defi|ne TopLe|
|00001b50| 66 74 28 61 52 65 63 74 | 29 09 28 2a 20 28 50 6f |ft(aRect|).(* (Po|
|00001b60| 69 6e 74 20 2a 29 20 26 | 28 61 52 65 63 74 29 2e |int *) &|(aRect).|
|00001b70| 74 6f 70 29 0d 23 64 65 | 66 69 6e 65 20 42 6f 74 |top).#de|fine Bot|
|00001b80| 52 69 67 68 74 28 61 52 | 65 63 74 29 09 28 2a 20 |Right(aR|ect).(* |
|00001b90| 28 50 6f 69 6e 74 20 2a | 29 20 26 28 61 52 65 63 |(Point *|) &(aRec|
|00001ba0| 74 29 2e 62 6f 74 74 6f | 6d 29 0d 0d 0d 65 78 74 |t).botto|m)...ext|
|00001bb0| 65 72 6e 20 76 6f 69 64 | 20 5f 44 61 74 61 49 6e |ern void| _DataIn|
|00001bc0| 69 74 28 29 3b 0d 0d 2f | 2a 20 54 68 69 73 20 72 |it();../|* This r|
|00001bd0| 6f 75 74 69 6e 65 20 69 | 73 20 70 61 72 74 20 6f |outine i|s part o|
|00001be0| 66 20 74 68 65 20 4d 50 | 57 20 72 75 6e 74 69 6d |f the MP|W runtim|
|00001bf0| 65 20 6c 69 62 72 61 72 | 79 2e 20 54 68 69 73 20 |e librar|y. This |
|00001c00| 65 78 74 65 72 6e 61 6c | 0d 20 20 20 72 65 66 65 |external|. refe|
|00001c10| 72 65 6e 63 65 20 74 6f | 20 69 74 20 69 73 20 64 |rence to| it is d|
|00001c20| 6f 6e 65 20 73 6f 20 74 | 68 61 74 20 77 65 20 63 |one so t|hat we c|
|00001c30| 61 6e 20 75 6e 6c 6f 61 | 64 20 69 74 73 20 73 65 |an unloa|d its se|
|00001c40| 67 6d 65 6e 74 2c 20 25 | 41 35 49 6e 69 74 2e 20 |gment, %|A5Init. |
|00001c50| 2a 2f 0d 0d 0d 23 64 65 | 66 69 6e 65 20 5f 5f 53 |*/...#de|fine __S|
|00001c60| 45 47 5f 5f 20 4d 61 69 | 6e 0d 6d 61 69 6e 28 29 |EG__ Mai|n.main()|
|00001c70| 0d 7b 0d 09 55 6e 6c 6f | 61 64 53 65 67 28 28 50 |.{..Unlo|adSeg((P|
|00001c80| 74 72 29 20 5f 44 61 74 | 61 49 6e 69 74 29 3b 09 |tr) _Dat|aInit);.|
|00001c90| 09 2f 2a 20 6e 6f 74 65 | 20 74 68 61 74 20 5f 44 |./* note| that _D|
|00001ca0| 61 74 61 49 6e 69 74 20 | 6d 75 73 74 20 6e 6f 74 |ataInit |must not|
|00001cb0| 20 62 65 20 69 6e 20 4d | 61 69 6e 21 20 2a 2f 0d | be in M|ain! */.|
|00001cc0| 09 46 6f 72 63 65 45 6e | 76 69 72 6f 6e 73 28 29 |.ForceEn|virons()|
|00001cd0| 3b 09 09 09 09 2f 2a 20 | 63 68 65 63 6b 20 66 6f |;..../* |check fo|
|00001ce0| 72 20 73 6f 6d 65 20 62 | 61 73 69 63 20 72 65 71 |r some b|asic req|
|00001cf0| 75 69 72 65 6d 65 6e 74 | 73 3b 20 65 78 69 74 73 |uirement|s; exits|
|00001d00| 20 69 66 20 6e 6f 74 20 | 6d 65 74 20 2a 2f 0d 09 | if not |met */..|
|00001d10| 4d 61 78 41 70 70 6c 5a | 6f 6e 65 28 29 3b 09 09 |MaxApplZ|one();..|
|00001d20| 09 09 09 2f 2a 20 65 78 | 70 61 6e 64 20 74 68 65 |.../* ex|pand the|
|00001d30| 20 68 65 61 70 20 73 6f | 20 63 6f 64 65 20 73 65 | heap so| code se|
|00001d40| 67 6d 65 6e 74 73 20 6c | 6f 61 64 20 61 74 20 74 |gments l|oad at t|
|00001d50| 68 65 20 74 6f 70 20 2a | 2f 0d 0d 09 49 6e 69 74 |he top *|/...Init|
|00001d60| 69 61 6c 69 7a 65 28 29 | 3b 09 09 09 09 09 2f 2a |ialize()|;...../*|
|00001d70| 20 69 6e 69 74 69 61 6c | 69 7a 65 20 74 68 65 20 | initial|ize the |
|00001d80| 70 72 6f 67 72 61 6d 20 | 2a 2f 0d 09 55 6e 6c 6f |program |*/..Unlo|
|00001d90| 61 64 53 65 67 28 28 50 | 74 72 29 20 49 6e 69 74 |adSeg((P|tr) Init|
|00001da0| 69 61 6c 69 7a 65 29 3b | 09 2f 2a 20 6e 6f 74 65 |ialize);|./* note|
|00001db0| 20 74 68 61 74 20 49 6e | 69 74 69 61 6c 69 7a 65 | that In|itialize|
|00001dc0| 20 6d 75 73 74 20 6e 6f | 74 20 62 65 20 69 6e 20 | must no|t be in |
|00001dd0| 4d 61 69 6e 21 20 2a 2f | 0d 0d 09 45 76 65 6e 74 |Main! */|...Event|
|00001de0| 4c 6f 6f 70 28 29 3b 09 | 09 09 09 09 2f 2a 20 63 |Loop();.|..../* c|
|00001df0| 61 6c 6c 20 74 68 65 20 | 6d 61 69 6e 20 65 76 65 |all the |main eve|
|00001e00| 6e 74 20 6c 6f 6f 70 20 | 2a 2f 0d 7d 0d 0d 0d 2f |nt loop |*/.}.../|
|00001e10| 2a 09 47 65 74 20 65 76 | 65 6e 74 73 20 66 6f 72 |*.Get ev|ents for|
|00001e20| 65 76 65 72 2c 20 61 6e | 64 20 68 61 6e 64 6c 65 |ever, an|d handle|
|00001e30| 20 74 68 65 6d 20 62 79 | 20 63 61 6c 6c 69 6e 67 | them by| calling|
|00001e40| 20 44 6f 45 76 65 6e 74 | 2e 0d 09 47 65 74 20 74 | DoEvent|...Get t|
|00001e50| 68 65 20 65 76 65 6e 74 | 73 20 62 79 20 63 61 6c |he event|s by cal|
|00001e60| 6c 69 6e 67 20 57 61 69 | 74 4e 65 78 74 45 76 65 |ling Wai|tNextEve|
|00001e70| 6e 74 2c 20 69 66 20 69 | 74 27 73 20 61 76 61 69 |nt, if i|t's avai|
|00001e80| 6c 61 62 6c 65 2c 20 6f | 74 68 65 72 77 69 73 65 |lable, o|therwise|
|00001e90| 0d 09 62 79 20 63 61 6c | 6c 69 6e 67 20 47 65 74 |..by cal|ling Get|
|00001ea0| 4e 65 78 74 45 76 65 6e | 74 2e 20 41 6c 73 6f 20 |NextEven|t. Also |
|00001eb0| 63 61 6c 6c 20 41 64 6a | 75 73 74 43 75 72 73 6f |call Adj|ustCurso|
|00001ec0| 72 20 65 61 63 68 20 74 | 69 6d 65 20 74 68 72 6f |r each t|ime thro|
|00001ed0| 75 67 68 20 74 68 65 20 | 6c 6f 6f 70 2e 20 2a 2f |ugh the |loop. */|
|00001ee0| 0d 0d 23 64 65 66 69 6e | 65 20 5f 5f 53 45 47 5f |..#defin|e __SEG_|
|00001ef0| 5f 20 4d 61 69 6e 0d 76 | 6f 69 64 20 45 76 65 6e |_ Main.v|oid Even|
|00001f00| 74 4c 6f 6f 70 28 29 0d | 7b 0d 09 52 67 6e 48 61 |tLoop().|{..RgnHa|
|00001f10| 6e 64 6c 65 09 63 75 72 | 73 6f 72 52 67 6e 3b 0d |ndle.cur|sorRgn;.|
|00001f20| 09 42 6f 6f 6c 65 61 6e | 09 09 67 6f 74 45 76 65 |.Boolean|..gotEve|
|00001f30| 6e 74 3b 0d 09 45 76 65 | 6e 74 52 65 63 6f 72 64 |nt;..Eve|ntRecord|
|00001f40| 09 65 76 65 6e 74 3b 0d | 0d 09 63 75 72 73 6f 72 |.event;.|..cursor|
|00001f50| 52 67 6e 20 3d 20 4e 65 | 77 52 67 6e 28 29 3b 09 |Rgn = Ne|wRgn();.|
|00001f60| 09 09 2f 2a 20 77 65 d5 | 6c 6c 20 70 61 73 73 20 |../* we.|ll pass |
|00001f70| 57 4e 45 20 61 6e 20 65 | 6d 70 74 79 20 72 65 67 |WNE an e|mpty reg|
|00001f80| 69 6f 6e 20 74 68 65 20 | 31 73 74 20 74 69 6d 65 |ion the |1st time|
|00001f90| 20 74 68 72 75 20 2a 2f | 0d 09 64 6f 20 7b 0d 09 | thru */|..do {..|
|00001fa0| 09 2f 2a 20 75 73 65 20 | 57 4e 45 20 69 66 20 69 |./* use |WNE if i|
|00001fb0| 74 20 69 73 20 61 76 61 | 69 6c 61 62 6c 65 20 2a |t is ava|ilable *|
|00001fc0| 2f 0d 09 09 69 66 20 28 | 20 67 48 61 73 57 61 69 |/...if (| gHasWai|
|00001fd0| 74 4e 65 78 74 45 76 65 | 6e 74 20 29 0d 09 09 09 |tNextEve|nt )....|
|00001fe0| 67 6f 74 45 76 65 6e 74 | 20 3d 20 57 61 69 74 4e |gotEvent| = WaitN|
|00001ff0| 65 78 74 45 76 65 6e 74 | 28 65 76 65 72 79 45 76 |extEvent|(everyEv|
|00002000| 65 6e 74 2c 20 26 65 76 | 65 6e 74 2c 20 4d 41 58 |ent, &ev|ent, MAX|
|00002010| 4c 4f 4e 47 2c 20 63 75 | 72 73 6f 72 52 67 6e 29 |LONG, cu|rsorRgn)|
|00002020| 3b 0d 09 09 65 6c 73 65 | 20 7b 0d 09 09 09 53 79 |;...else| {....Sy|
|00002030| 73 74 65 6d 54 61 73 6b | 28 29 3b 0d 09 09 09 67 |stemTask|();....g|
|00002040| 6f 74 45 76 65 6e 74 20 | 3d 20 47 65 74 4e 65 78 |otEvent |= GetNex|
|00002050| 74 45 76 65 6e 74 28 65 | 76 65 72 79 45 76 65 6e |tEvent(e|veryEven|
|00002060| 74 2c 20 26 65 76 65 6e | 74 29 3b 0d 09 09 7d 0d |t, &even|t);...}.|
|00002070| 09 09 69 66 20 28 20 67 | 6f 74 45 76 65 6e 74 20 |..if ( g|otEvent |
|00002080| 29 20 7b 0d 09 09 09 2f | 2a 20 6d 61 6b 65 20 73 |) {..../|* make s|
|00002090| 75 72 65 20 77 65 20 68 | 61 76 65 20 74 68 65 20 |ure we h|ave the |
|000020a0| 72 69 67 68 74 20 63 75 | 72 73 6f 72 20 62 65 66 |right cu|rsor bef|
|000020b0| 6f 72 65 20 68 61 6e 64 | 6c 69 6e 67 20 74 68 65 |ore hand|ling the|
|000020c0| 20 65 76 65 6e 74 20 2a | 2f 0d 09 09 09 41 64 6a | event *|/....Adj|
|000020d0| 75 73 74 43 75 72 73 6f | 72 28 65 76 65 6e 74 2e |ustCurso|r(event.|
|000020e0| 77 68 65 72 65 2c 20 63 | 75 72 73 6f 72 52 67 6e |where, c|ursorRgn|
|000020f0| 29 3b 0d 09 09 09 44 6f | 45 76 65 6e 74 28 26 65 |);....Do|Event(&e|
|00002100| 76 65 6e 74 29 3b 0d 09 | 09 7d 0d 09 09 2f 2a 20 |vent);..|.}.../* |
|00002110| 63 68 61 6e 67 65 20 74 | 68 65 20 63 75 72 73 6f |change t|he curso|
|00002120| 72 20 28 61 6e 64 20 72 | 65 67 69 6f 6e 29 20 69 |r (and r|egion) i|
|00002130| 66 20 6e 65 63 65 73 73 | 61 72 79 20 2a 2f 0d 09 |f necess|ary */..|
|00002140| 09 41 64 6a 75 73 74 43 | 75 72 73 6f 72 28 65 76 |.AdjustC|ursor(ev|
|00002150| 65 6e 74 2e 77 68 65 72 | 65 2c 20 63 75 72 73 6f |ent.wher|e, curso|
|00002160| 72 52 67 6e 29 3b 0d 09 | 7d 20 77 68 69 6c 65 20 |rRgn);..|} while |
|00002170| 28 20 74 72 75 65 20 29 | 3b 09 2f 2a 20 6c 6f 6f |( true )|;./* loo|
|00002180| 70 20 66 6f 72 65 76 65 | 72 3b 20 77 65 20 71 75 |p foreve|r; we qu|
|00002190| 69 74 20 76 69 61 20 45 | 78 69 74 54 6f 53 68 65 |it via E|xitToShe|
|000021a0| 6c 6c 20 2a 2f 0d 7d 20 | 2f 2a 45 76 65 6e 74 4c |ll */.} |/*EventL|
|000021b0| 6f 6f 70 2a 2f 0d 0d 0d | 2f 2a 20 44 6f 20 74 68 |oop*/...|/* Do th|
|000021c0| 65 20 72 69 67 68 74 20 | 74 68 69 6e 67 20 66 6f |e right |thing fo|
|000021d0| 72 20 61 6e 20 65 76 65 | 6e 74 2e 20 44 65 74 65 |r an eve|nt. Dete|
|000021e0| 72 6d 69 6e 65 20 77 68 | 61 74 20 6b 69 6e 64 20 |rmine wh|at kind |
|000021f0| 6f 66 20 65 76 65 6e 74 | 20 69 74 20 69 73 2c 20 |of event| it is, |
|00002200| 61 6e 64 20 63 61 6c 6c | 0d 20 74 68 65 20 61 70 |and call|. the ap|
|00002210| 70 72 6f 70 72 69 61 74 | 65 20 72 6f 75 74 69 6e |propriat|e routin|
|00002220| 65 73 2e 20 2a 2f 0d 0d | 23 64 65 66 69 6e 65 20 |es. */..|#define |
|00002230| 5f 5f 53 45 47 5f 5f 20 | 4d 61 69 6e 0d 76 6f 69 |__SEG__ |Main.voi|
|00002240| 64 20 44 6f 45 76 65 6e | 74 28 65 76 65 6e 74 29 |d DoEven|t(event)|
|00002250| 0d 09 45 76 65 6e 74 52 | 65 63 6f 72 64 09 2a 65 |..EventR|ecord.*e|
|00002260| 76 65 6e 74 3b 0d 7b 0d | 09 73 68 6f 72 74 09 09 |vent;.{.|.short..|
|00002270| 70 61 72 74 3b 0d 09 57 | 69 6e 64 6f 77 50 74 72 |part;..W|indowPtr|
|00002280| 09 77 69 6e 64 6f 77 3b | 0d 09 42 6f 6f 6c 65 61 |.window;|..Boolea|
|00002290| 6e 09 09 68 69 74 3b 0d | 09 63 68 61 72 09 09 6b |n..hit;.|.char..k|
|000022a0| 65 79 3b 0d 0d 09 73 77 | 69 74 63 68 20 28 20 65 |ey;...sw|itch ( e|
|000022b0| 76 65 6e 74 2d 3e 77 68 | 61 74 20 29 20 7b 0d 09 |vent->wh|at ) {..|
|000022c0| 09 63 61 73 65 20 6d 6f | 75 73 65 44 6f 77 6e 3a |.case mo|useDown:|
|000022d0| 0d 09 09 09 70 61 72 74 | 20 3d 20 46 69 6e 64 57 |....part| = FindW|
|000022e0| 69 6e 64 6f 77 28 65 76 | 65 6e 74 2d 3e 77 68 65 |indow(ev|ent->whe|
|000022f0| 72 65 2c 20 26 77 69 6e | 64 6f 77 29 3b 0d 09 09 |re, &win|dow);...|
|00002300| 09 73 77 69 74 63 68 20 | 28 20 70 61 72 74 20 29 |.switch |( part )|
|00002310| 20 7b 0d 09 09 09 09 63 | 61 73 65 20 69 6e 4d 65 | {.....c|ase inMe|
|00002320| 6e 75 42 61 72 3a 09 09 | 09 09 2f 2a 20 70 72 6f |nuBar:..|../* pro|
|00002330| 63 65 73 73 20 61 20 6d | 6f 75 73 65 20 6d 65 6e |cess a m|ouse men|
|00002340| 75 20 63 6f 6d 6d 61 6e | 64 20 28 69 66 20 61 6e |u comman|d (if an|
|00002350| 79 29 20 2a 2f 0d 09 09 | 09 09 09 41 64 6a 75 73 |y) */...|...Adjus|
|00002360| 74 4d 65 6e 75 73 28 29 | 3b 0d 09 09 09 09 09 44 |tMenus()|;......D|
|00002370| 6f 4d 65 6e 75 43 6f 6d | 6d 61 6e 64 28 4d 65 6e |oMenuCom|mand(Men|
|00002380| 75 53 65 6c 65 63 74 28 | 65 76 65 6e 74 2d 3e 77 |uSelect(|event->w|
|00002390| 68 65 72 65 29 29 3b 0d | 09 09 09 09 09 62 72 65 |here));.|.....bre|
|000023a0| 61 6b 3b 0d 09 09 09 09 | 63 61 73 65 20 69 6e 53 |ak;.....|case inS|
|000023b0| 79 73 57 69 6e 64 6f 77 | 3a 09 09 09 2f 2a 20 6c |ysWindow|:.../* l|
|000023c0| 65 74 20 74 68 65 20 73 | 79 73 74 65 6d 20 68 61 |et the s|ystem ha|
|000023d0| 6e 64 6c 65 20 74 68 65 | 20 6d 6f 75 73 65 44 6f |ndle the| mouseDo|
|000023e0| 77 6e 20 2a 2f 0d 09 09 | 09 09 09 53 79 73 74 65 |wn */...|...Syste|
|000023f0| 6d 43 6c 69 63 6b 28 65 | 76 65 6e 74 2c 20 77 69 |mClick(e|vent, wi|
|00002400| 6e 64 6f 77 29 3b 0d 09 | 09 09 09 09 62 72 65 61 |ndow);..|....brea|
|00002410| 6b 3b 0d 09 09 09 09 63 | 61 73 65 20 69 6e 43 6f |k;.....c|ase inCo|
|00002420| 6e 74 65 6e 74 3a 0d 09 | 09 09 09 09 69 66 20 28 |ntent:..|....if (|
|00002430| 20 77 69 6e 64 6f 77 20 | 21 3d 20 46 72 6f 6e 74 | window |!= Front|
|00002440| 57 69 6e 64 6f 77 28 29 | 20 29 20 7b 0d 09 09 09 |Window()| ) {....|
|00002450| 09 09 09 53 65 6c 65 63 | 74 57 69 6e 64 6f 77 28 |...Selec|tWindow(|
|00002460| 77 69 6e 64 6f 77 29 3b | 0d 09 09 09 09 09 09 2f |window);|......./|
|00002470| 2a 44 6f 45 76 65 6e 74 | 28 65 76 65 6e 74 29 3b |*DoEvent|(event);|
|00002480| 2a 2f 09 2f 2a 20 75 73 | 65 20 74 68 69 73 20 6c |*/./* us|e this l|
|00002490| 69 6e 65 20 66 6f 72 20 | 22 64 6f 20 66 69 72 73 |ine for |"do firs|
|000024a0| 74 20 63 6c 69 63 6b 22 | 20 2a 2f 0d 09 09 09 09 |t click"| */.....|
|000024b0| 09 7d 20 65 6c 73 65 0d | 09 09 09 09 09 09 44 6f |.} else.|......Do|
|000024c0| 43 6f 6e 74 65 6e 74 43 | 6c 69 63 6b 28 77 69 6e |ContentC|lick(win|
|000024d0| 64 6f 77 29 3b 0d 09 09 | 09 09 09 62 72 65 61 6b |dow);...|...break|
|000024e0| 3b 0d 09 09 09 09 63 61 | 73 65 20 69 6e 44 72 61 |;.....ca|se inDra|
|000024f0| 67 3a 09 09 09 09 2f 2a | 20 70 61 73 73 20 73 63 |g:..../*| pass sc|
|00002500| 72 65 65 6e 42 69 74 73 | 2e 62 6f 75 6e 64 73 20 |reenBits|.bounds |
|00002510| 74 6f 20 67 65 74 20 61 | 6c 6c 20 67 44 65 76 69 |to get a|ll gDevi|
|00002520| 63 65 73 20 2a 2f 0d 09 | 09 09 09 09 44 72 61 67 |ces */..|....Drag|
|00002530| 57 69 6e 64 6f 77 28 77 | 69 6e 64 6f 77 2c 20 65 |Window(w|indow, e|
|00002540| 76 65 6e 74 2d 3e 77 68 | 65 72 65 2c 20 26 71 64 |vent->wh|ere, &qd|
|00002550| 2e 73 63 72 65 65 6e 42 | 69 74 73 2e 62 6f 75 6e |.screenB|its.boun|
|00002560| 64 73 29 3b 0d 09 09 09 | 09 09 62 72 65 61 6b 3b |ds);....|..break;|
|00002570| 0d 09 09 09 09 63 61 73 | 65 20 69 6e 47 72 6f 77 |.....cas|e inGrow|
|00002580| 3a 0d 09 09 09 09 09 62 | 72 65 61 6b 3b 0d 09 09 |:......b|reak;...|
|00002590| 09 09 63 61 73 65 20 69 | 6e 5a 6f 6f 6d 49 6e 3a |..case i|nZoomIn:|
|000025a0| 0d 09 09 09 09 63 61 73 | 65 20 69 6e 5a 6f 6f 6d |.....cas|e inZoom|
|000025b0| 4f 75 74 3a 0d 09 09 09 | 09 09 68 69 74 20 3d 20 |Out:....|..hit = |
|000025c0| 54 72 61 63 6b 42 6f 78 | 28 77 69 6e 64 6f 77 2c |TrackBox|(window,|
|000025d0| 20 65 76 65 6e 74 2d 3e | 77 68 65 72 65 2c 20 70 | event->|where, p|
|000025e0| 61 72 74 29 3b 0d 09 09 | 09 09 09 69 66 20 28 20 |art);...|...if ( |
|000025f0| 68 69 74 20 29 20 7b 0d | 09 09 09 09 09 09 53 65 |hit ) {.|......Se|
|00002600| 74 50 6f 72 74 28 77 69 | 6e 64 6f 77 29 3b 09 09 |tPort(wi|ndow);..|
|00002610| 09 09 2f 2a 20 74 68 65 | 20 77 69 6e 64 6f 77 20 |../* the| window |
|00002620| 6d 75 73 74 20 62 65 20 | 74 68 65 20 63 75 72 72 |must be |the curr|
|00002630| 65 6e 74 20 70 6f 72 74 | 2e 2e 2e 20 2a 2f 0d 09 |ent port|... */..|
|00002640| 09 09 09 09 09 45 72 61 | 73 65 52 65 63 74 28 26 |.....Era|seRect(&|
|00002650| 77 69 6e 64 6f 77 2d 3e | 70 6f 72 74 52 65 63 74 |window->|portRect|
|00002660| 29 3b 09 2f 2a 20 62 65 | 63 61 75 73 65 20 6f 66 |);./* be|cause of|
|00002670| 20 61 20 62 75 67 20 69 | 6e 20 5a 6f 6f 6d 57 69 | a bug i|n ZoomWi|
|00002680| 6e 64 6f 77 20 2a 2f 0d | 09 09 09 09 09 09 5a 6f |ndow */.|......Zo|
|00002690| 6f 6d 57 69 6e 64 6f 77 | 28 77 69 6e 64 6f 77 2c |omWindow|(window,|
|000026a0| 20 70 61 72 74 2c 20 74 | 72 75 65 29 3b 09 2f 2a | part, t|rue);./*|
|000026b0| 20 6e 6f 74 65 20 74 68 | 61 74 20 77 65 20 69 6e | note th|at we in|
|000026c0| 76 61 6c 69 64 61 74 65 | 20 61 6e 64 20 65 72 61 |validate| and era|
|000026d0| 73 65 2e 2e 2e 20 2a 2f | 0d 09 09 09 09 09 09 49 |se... */|.......I|
|000026e0| 6e 76 61 6c 52 65 63 74 | 28 26 77 69 6e 64 6f 77 |nvalRect|(&window|
|000026f0| 2d 3e 70 6f 72 74 52 65 | 63 74 29 3b 09 2f 2a 20 |->portRe|ct);./* |
|00002700| 74 6f 20 6d 61 6b 65 20 | 74 68 69 6e 67 73 20 6c |to make |things l|
|00002710| 6f 6f 6b 20 62 65 74 74 | 65 72 20 6f 6e 2d 73 63 |ook bett|er on-sc|
|00002720| 72 65 65 6e 20 2a 2f 0d | 09 09 09 09 09 7d 0d 09 |reen */.|.....}..|
|00002730| 09 09 09 09 62 72 65 61 | 6b 3b 0d 09 09 09 7d 0d |....brea|k;....}.|
|00002740| 09 09 09 62 72 65 61 6b | 3b 0d 09 09 63 61 73 65 |...break|;...case|
|00002750| 20 6b 65 79 44 6f 77 6e | 3a 0d 09 09 63 61 73 65 | keyDown|:...case|
|00002760| 20 61 75 74 6f 4b 65 79 | 3a 09 09 09 09 09 09 2f | autoKey|:....../|
|00002770| 2a 20 63 68 65 63 6b 20 | 66 6f 72 20 6d 65 6e 75 |* check |for menu|
|00002780| 6b 65 79 20 65 71 75 69 | 76 61 6c 65 6e 74 73 20 |key equi|valents |
|00002790| 2a 2f 0d 09 09 09 6b 65 | 79 20 3d 20 65 76 65 6e |*/....ke|y = even|
|000027a0| 74 2d 3e 6d 65 73 73 61 | 67 65 20 26 20 63 68 61 |t->messa|ge & cha|
|000027b0| 72 43 6f 64 65 4d 61 73 | 6b 3b 0d 09 09 09 69 66 |rCodeMas|k;....if|
|000027c0| 20 28 20 65 76 65 6e 74 | 2d 3e 6d 6f 64 69 66 69 | ( event|->modifi|
|000027d0| 65 72 73 20 26 20 63 6d | 64 4b 65 79 20 29 09 09 |ers & cm|dKey )..|
|000027e0| 09 2f 2a 20 43 6f 6d 6d | 61 6e 64 20 6b 65 79 20 |./* Comm|and key |
|000027f0| 64 6f 77 6e 20 2a 2f 0d | 09 09 09 09 69 66 20 28 |down */.|....if (|
|00002800| 20 65 76 65 6e 74 2d 3e | 77 68 61 74 20 3d 3d 20 | event->|what == |
|00002810| 6b 65 79 44 6f 77 6e 20 | 29 20 7b 0d 09 09 09 09 |keyDown |) {.....|
|00002820| 09 41 64 6a 75 73 74 4d | 65 6e 75 73 28 29 3b 09 |.AdjustM|enus();.|
|00002830| 09 09 09 09 09 2f 2a 20 | 65 6e 61 62 6c 65 2f 64 |...../* |enable/d|
|00002840| 69 73 61 62 6c 65 2f 63 | 68 65 63 6b 20 6d 65 6e |isable/c|heck men|
|00002850| 75 20 69 74 65 6d 73 20 | 70 72 6f 70 65 72 6c 79 |u items |properly|
|00002860| 20 2a 2f 0d 09 09 09 09 | 09 44 6f 4d 65 6e 75 43 | */.....|.DoMenuC|
|00002870| 6f 6d 6d 61 6e 64 28 4d | 65 6e 75 4b 65 79 28 6b |ommand(M|enuKey(k|
|00002880| 65 79 29 29 3b 0d 09 09 | 09 09 7d 0d 09 09 09 62 |ey));...|..}....b|
|00002890| 72 65 61 6b 3b 0d 09 09 | 63 61 73 65 20 61 63 74 |reak;...|case act|
|000028a0| 69 76 61 74 65 45 76 74 | 3a 0d 09 09 09 44 6f 41 |ivateEvt|:....DoA|
|000028b0| 63 74 69 76 61 74 65 28 | 28 57 69 6e 64 6f 77 50 |ctivate(|(WindowP|
|000028c0| 74 72 29 20 65 76 65 6e | 74 2d 3e 6d 65 73 73 61 |tr) even|t->messa|
|000028d0| 67 65 2c 20 28 65 76 65 | 6e 74 2d 3e 6d 6f 64 69 |ge, (eve|nt->modi|
|000028e0| 66 69 65 72 73 20 26 20 | 61 63 74 69 76 65 46 6c |fiers & |activeFl|
|000028f0| 61 67 29 20 21 3d 20 30 | 29 3b 0d 09 09 09 62 72 |ag) != 0|);....br|
|00002900| 65 61 6b 3b 0d 09 09 63 | 61 73 65 20 75 70 64 61 |eak;...c|ase upda|
|00002910| 74 65 45 76 74 3a 0d 09 | 09 09 44 6f 55 70 64 61 |teEvt:..|..DoUpda|
|00002920| 74 65 28 28 57 69 6e 64 | 6f 77 50 74 72 29 20 65 |te((Wind|owPtr) e|
|00002930| 76 65 6e 74 2d 3e 6d 65 | 73 73 61 67 65 29 3b 0d |vent->me|ssage);.|
|00002940| 09 09 09 62 72 65 61 6b | 3b 0d 09 09 63 61 73 65 |...break|;...case|
|00002950| 20 6f 73 45 76 65 6e 74 | 3a 0d 09 09 09 73 77 69 | osEvent|:....swi|
|00002960| 74 63 68 20 28 65 76 65 | 6e 74 2d 3e 6d 65 73 73 |tch (eve|nt->mess|
|00002970| 61 67 65 20 3e 3e 20 32 | 34 29 20 7b 20 09 09 09 |age >> 2|4) { ...|
|00002980| 2f 2a 20 68 69 67 68 20 | 62 79 74 65 20 6f 66 20 |/* high |byte of |
|00002990| 6d 65 73 73 61 67 65 20 | 2a 2f 0d 09 09 09 09 63 |message |*/.....c|
|000029a0| 61 73 65 20 73 75 73 70 | 65 6e 64 52 65 73 75 6d |ase susp|endResum|
|000029b0| 65 4d 65 73 73 61 67 65 | 3a 09 09 09 09 2f 2a 20 |eMessage|:..../* |
|000029c0| 73 75 73 70 65 6e 64 2f | 72 65 73 75 6d 65 20 69 |suspend/|resume i|
|000029d0| 73 20 61 6c 73 6f 20 61 | 6e 20 61 63 74 69 76 61 |s also a|n activa|
|000029e0| 74 65 2f 64 65 61 63 74 | 69 76 61 74 65 20 2a 2f |te/deact|ivate */|
|000029f0| 0d 09 09 09 09 09 67 49 | 6e 42 61 63 6b 67 72 6f |......gI|nBackgro|
|00002a00| 75 6e 64 20 3d 20 28 65 | 76 65 6e 74 2d 3e 6d 65 |und = (e|vent->me|
|00002a10| 73 73 61 67 65 20 26 20 | 72 65 73 75 6d 65 4d 61 |ssage & |resumeMa|
|00002a20| 73 6b 29 20 3d 3d 20 30 | 3b 0d 09 09 09 09 09 44 |sk) == 0|;......D|
|00002a30| 6f 41 63 74 69 76 61 74 | 65 28 46 72 6f 6e 74 57 |oActivat|e(FrontW|
|00002a40| 69 6e 64 6f 77 28 29 2c | 20 21 67 49 6e 42 61 63 |indow(),| !gInBac|
|00002a50| 6b 67 72 6f 75 6e 64 29 | 3b 0d 09 09 09 09 09 62 |kground)|;......b|
|00002a60| 72 65 61 6b 3b 0d 09 09 | 09 7d 0d 09 09 09 62 72 |reak;...|.}....br|
|00002a70| 65 61 6b 3b 0d 09 7d 0d | 7d 20 2f 2a 44 6f 45 76 |eak;..}.|} /*DoEv|
|00002a80| 65 6e 74 2a 2f 0d 0d 0d | 2f 2a 09 43 68 61 6e 67 |ent*/...|/*.Chang|
|00002a90| 65 20 74 68 65 20 63 75 | 72 73 6f 72 27 73 20 73 |e the cu|rsor's s|
|00002aa0| 68 61 70 65 2c 20 64 65 | 70 65 6e 64 69 6e 67 20 |hape, de|pending |
|00002ab0| 6f 6e 20 69 74 73 20 70 | 6f 73 69 74 69 6f 6e 2e |on its p|osition.|
|00002ac0| 20 54 68 69 73 20 61 6c | 73 6f 20 63 61 6c 63 75 | This al|so calcu|
|00002ad0| 6c 61 74 65 73 20 74 68 | 65 20 72 65 67 69 6f 6e |lates th|e region|
|00002ae0| 0d 09 77 68 65 72 65 20 | 74 68 65 20 63 75 72 72 |..where |the curr|
|00002af0| 65 6e 74 20 63 75 72 73 | 6f 72 20 72 65 73 69 64 |ent curs|or resid|
|00002b00| 65 73 20 28 66 6f 72 20 | 57 61 69 74 4e 65 78 74 |es (for |WaitNext|
|00002b10| 45 76 65 6e 74 29 2e 20 | 49 66 20 74 68 65 20 6d |Event). |If the m|
|00002b20| 6f 75 73 65 20 69 73 20 | 65 76 65 72 20 6f 75 74 |ouse is |ever out|
|00002b30| 73 69 64 65 20 6f 66 0d | 09 74 68 61 74 20 72 65 |side of.|.that re|
|00002b40| 67 69 6f 6e 2c 20 61 6e | 20 65 76 65 6e 74 20 77 |gion, an| event w|
|00002b50| 6f 75 6c 64 20 62 65 20 | 67 65 6e 65 72 61 74 65 |ould be |generate|
|00002b60| 64 2c 20 63 61 75 73 69 | 6e 67 20 74 68 69 73 20 |d, causi|ng this |
|00002b70| 72 6f 75 74 69 6e 65 20 | 74 6f 20 62 65 20 63 61 |routine |to be ca|
|00002b80| 6c 6c 65 64 2c 0d 09 61 | 6c 6c 6f 77 69 6e 67 20 |lled,..a|llowing |
|00002b90| 75 73 20 74 6f 20 63 68 | 61 6e 67 65 20 74 68 65 |us to ch|ange the|
|00002ba0| 20 72 65 67 69 6f 6e 20 | 74 6f 20 74 68 65 20 72 | region |to the r|
|00002bb0| 65 67 69 6f 6e 20 74 68 | 65 20 6d 6f 75 73 65 20 |egion th|e mouse |
|00002bc0| 69 73 20 63 75 72 72 65 | 6e 74 6c 79 20 69 6e 2e |is curre|ntly in.|
|00002bd0| 20 49 66 0d 09 74 68 65 | 72 65 20 69 73 20 6d 6f | If..the|re is mo|
|00002be0| 72 65 20 74 6f 20 74 68 | 65 20 65 76 65 6e 74 20 |re to th|e event |
|00002bf0| 74 68 61 6e 20 6a 75 73 | 74 20 d2 74 68 65 20 6d |than jus|t .the m|
|00002c00| 6f 75 73 65 20 6d 6f 76 | 65 64 d3 2c 20 77 65 20 |ouse mov|ed., we |
|00002c10| 67 65 74 20 63 61 6c 6c | 65 64 20 62 65 66 6f 72 |get call|ed befor|
|00002c20| 65 20 74 68 65 0d 09 65 | 76 65 6e 74 20 69 73 20 |e the..e|vent is |
|00002c30| 70 72 6f 63 65 73 73 65 | 64 20 74 6f 20 6d 61 6b |processe|d to mak|
|00002c40| 65 20 73 75 72 65 20 74 | 68 65 20 63 75 72 73 6f |e sure t|he curso|
|00002c50| 72 20 69 73 20 74 68 65 | 20 72 69 67 68 74 20 6f |r is the| right o|
|00002c60| 6e 65 2e 20 49 6e 20 61 | 6e 79 20 28 61 68 65 6d |ne. In a|ny (ahem|
|00002c70| 29 20 65 76 65 6e 74 2c | 0d 09 74 68 69 73 20 69 |) event,|..this i|
|00002c80| 73 20 63 61 6c 6c 65 64 | 20 61 67 61 69 6e 20 62 |s called| again b|
|00002c90| 65 66 6f 72 65 20 77 65 | 20 66 61 6c 6c 20 62 61 |efore we| fall ba|
|00002ca0| 63 6b 20 69 6e 74 6f 20 | 57 4e 45 2e 20 2a 2f 0d |ck into |WNE. */.|
|00002cb0| 0d 23 64 65 66 69 6e 65 | 20 5f 5f 53 45 47 5f 5f |.#define| __SEG__|
|00002cc0| 20 4d 61 69 6e 0d 76 6f | 69 64 20 41 64 6a 75 73 | Main.vo|id Adjus|
|00002cd0| 74 43 75 72 73 6f 72 28 | 6d 6f 75 73 65 2c 72 65 |tCursor(|mouse,re|
|00002ce0| 67 69 6f 6e 29 0d 09 50 | 6f 69 6e 74 09 09 6d 6f |gion)..P|oint..mo|
|00002cf0| 75 73 65 3b 0d 09 52 67 | 6e 48 61 6e 64 6c 65 09 |use;..Rg|nHandle.|
|00002d00| 72 65 67 69 6f 6e 3b 0d | 7b 0d 09 57 69 6e 64 6f |region;.|{..Windo|
|00002d10| 77 50 74 72 09 77 69 6e | 64 6f 77 3b 0d 09 52 67 |wPtr.win|dow;..Rg|
|00002d20| 6e 48 61 6e 64 6c 65 09 | 61 72 72 6f 77 52 67 6e |nHandle.|arrowRgn|
|00002d30| 3b 0d 09 52 67 6e 48 61 | 6e 64 6c 65 09 70 6c 75 |;..RgnHa|ndle.plu|
|00002d40| 73 52 67 6e 3b 0d 09 52 | 65 63 74 09 09 67 6c 6f |sRgn;..R|ect..glo|
|00002d50| 62 61 6c 50 6f 72 74 52 | 65 63 74 3b 0d 0d 09 77 |balPortR|ect;...w|
|00002d60| 69 6e 64 6f 77 20 3d 20 | 46 72 6f 6e 74 57 69 6e |indow = |FrontWin|
|00002d70| 64 6f 77 28 29 3b 09 2f | 2a 20 77 65 20 6f 6e 6c |dow();./|* we onl|
|00002d80| 79 20 61 64 6a 75 73 74 | 20 74 68 65 20 63 75 72 |y adjust| the cur|
|00002d90| 73 6f 72 20 77 68 65 6e | 20 77 65 20 61 72 65 20 |sor when| we are |
|00002da0| 69 6e 20 66 72 6f 6e 74 | 20 2a 2f 0d 09 69 66 20 |in front| */..if |
|00002db0| 28 20 28 21 20 67 49 6e | 42 61 63 6b 67 72 6f 75 |( (! gIn|Backgrou|
|00002dc0| 6e 64 29 20 26 26 20 28 | 21 20 49 73 44 41 57 69 |nd) && (|! IsDAWi|
|00002dd0| 6e 64 6f 77 28 77 69 6e | 64 6f 77 29 29 20 29 20 |ndow(win|dow)) ) |
|00002de0| 7b 0d 09 09 2f 2a 20 63 | 61 6c 63 75 6c 61 74 65 |{.../* c|alculate|
|00002df0| 20 72 65 67 69 6f 6e 73 | 20 66 6f 72 20 64 69 66 | regions| for dif|
|00002e00| 66 65 72 65 6e 74 20 63 | 75 72 73 6f 72 20 73 68 |ferent c|ursor sh|
|00002e10| 61 70 65 73 20 2a 2f 0d | 09 09 61 72 72 6f 77 52 |apes */.|..arrowR|
|00002e20| 67 6e 20 3d 20 4e 65 77 | 52 67 6e 28 29 3b 0d 09 |gn = New|Rgn();..|
|00002e30| 09 70 6c 75 73 52 67 6e | 20 3d 20 4e 65 77 52 67 |.plusRgn| = NewRg|
|00002e40| 6e 28 29 3b 0d 0d 09 09 | 2f 2a 20 73 74 61 72 74 |n();....|/* start|
|00002e50| 20 77 69 74 68 20 61 20 | 62 69 67 2c 20 62 69 67 | with a |big, big|
|00002e60| 20 72 65 63 74 61 6e 67 | 75 6c 61 72 20 72 65 67 | rectang|ular reg|
|00002e70| 69 6f 6e 20 2a 2f 0d 09 | 09 53 65 74 52 65 63 74 |ion */..|.SetRect|
|00002e80| 52 67 6e 28 61 72 72 6f | 77 52 67 6e 2c 20 65 78 |Rgn(arro|wRgn, ex|
|00002e90| 74 72 65 6d 65 4e 65 67 | 2c 20 65 78 74 72 65 6d |tremeNeg|, extrem|
|00002ea0| 65 4e 65 67 2c 20 65 78 | 74 72 65 6d 65 50 6f 73 |eNeg, ex|tremePos|
|00002eb0| 2c 20 65 78 74 72 65 6d | 65 50 6f 73 29 3b 0d 0d |, extrem|ePos);..|
|00002ec0| 09 09 2f 2a 20 63 61 6c | 63 75 6c 61 74 65 20 70 |../* cal|culate p|
|00002ed0| 6c 75 73 52 67 6e 20 2a | 2f 0d 09 09 69 66 20 28 |lusRgn *|/...if (|
|00002ee0| 20 49 73 41 70 70 57 69 | 6e 64 6f 77 28 77 69 6e | IsAppWi|ndow(win|
|00002ef0| 64 6f 77 29 20 29 20 7b | 0d 09 09 09 53 65 74 50 |dow) ) {|....SetP|
|00002f00| 6f 72 74 28 77 69 6e 64 | 6f 77 29 3b 09 2f 2a 20 |ort(wind|ow);./* |
|00002f10| 6d 61 6b 65 20 61 20 67 | 6c 6f 62 61 6c 20 76 65 |make a g|lobal ve|
|00002f20| 72 73 69 6f 6e 20 6f 66 | 20 74 68 65 20 76 69 65 |rsion of| the vie|
|00002f30| 77 52 65 63 74 20 2a 2f | 0d 09 09 09 53 65 74 4f |wRect */|....SetO|
|00002f40| 72 69 67 69 6e 28 2d 77 | 69 6e 64 6f 77 2d 3e 70 |rigin(-w|indow->p|
|00002f50| 6f 72 74 42 69 74 73 2e | 62 6f 75 6e 64 73 2e 6c |ortBits.|bounds.l|
|00002f60| 65 66 74 2c 20 2d 77 69 | 6e 64 6f 77 2d 3e 70 6f |eft, -wi|ndow->po|
|00002f70| 72 74 42 69 74 73 2e 62 | 6f 75 6e 64 73 2e 74 6f |rtBits.b|ounds.to|
|00002f80| 70 29 3b 0d 09 09 09 67 | 6c 6f 62 61 6c 50 6f 72 |p);....g|lobalPor|
|00002f90| 74 52 65 63 74 20 3d 20 | 77 69 6e 64 6f 77 2d 3e |tRect = |window->|
|00002fa0| 70 6f 72 74 52 65 63 74 | 3b 0d 09 09 09 52 65 63 |portRect|;....Rec|
|00002fb0| 74 52 67 6e 28 70 6c 75 | 73 52 67 6e 2c 20 26 67 |tRgn(plu|sRgn, &g|
|00002fc0| 6c 6f 62 61 6c 50 6f 72 | 74 52 65 63 74 29 3b 0d |lobalPor|tRect);.|
|00002fd0| 09 09 09 53 65 63 74 52 | 67 6e 28 70 6c 75 73 52 |...SectR|gn(plusR|
|00002fe0| 67 6e 2c 20 77 69 6e 64 | 6f 77 2d 3e 76 69 73 52 |gn, wind|ow->visR|
|00002ff0| 67 6e 2c 20 70 6c 75 73 | 52 67 6e 29 3b 0d 09 09 |gn, plus|Rgn);...|
|00003000| 09 53 65 74 4f 72 69 67 | 69 6e 28 30 2c 20 30 29 |.SetOrig|in(0, 0)|
|00003010| 3b 0d 09 09 7d 0d 0d 09 | 09 2f 2a 20 73 75 62 74 |;...}...|./* subt|
|00003020| 72 61 63 74 20 6f 74 68 | 65 72 20 72 65 67 69 6f |ract oth|er regio|
|00003030| 6e 73 20 66 72 6f 6d 20 | 61 72 72 6f 77 52 67 6e |ns from |arrowRgn|
|00003040| 20 2a 2f 0d 09 09 44 69 | 66 66 52 67 6e 28 61 72 | */...Di|ffRgn(ar|
|00003050| 72 6f 77 52 67 6e 2c 20 | 70 6c 75 73 52 67 6e 2c |rowRgn, |plusRgn,|
|00003060| 20 61 72 72 6f 77 52 67 | 6e 29 3b 0d 0d 09 09 2f | arrowRg|n);..../|
|00003070| 2a 20 63 68 61 6e 67 65 | 20 74 68 65 20 63 75 72 |* change| the cur|
|00003080| 73 6f 72 20 61 6e 64 20 | 74 68 65 20 72 65 67 69 |sor and |the regi|
|00003090| 6f 6e 20 70 61 72 61 6d | 65 74 65 72 20 2a 2f 0d |on param|eter */.|
|000030a0| 09 09 69 66 20 28 20 50 | 74 49 6e 52 67 6e 28 6d |..if ( P|tInRgn(m|
|000030b0| 6f 75 73 65 2c 20 70 6c | 75 73 52 67 6e 29 20 29 |ouse, pl|usRgn) )|
|000030c0| 20 7b 0d 09 09 09 53 65 | 74 43 75 72 73 6f 72 28 | {....Se|tCursor(|
|000030d0| 2a 47 65 74 43 75 72 73 | 6f 72 28 70 6c 75 73 43 |*GetCurs|or(plusC|
|000030e0| 75 72 73 6f 72 29 29 3b | 0d 09 09 09 43 6f 70 79 |ursor));|....Copy|
|000030f0| 52 67 6e 28 70 6c 75 73 | 52 67 6e 2c 20 72 65 67 |Rgn(plus|Rgn, reg|
|00003100| 69 6f 6e 29 3b 0d 09 09 | 7d 20 65 6c 73 65 20 7b |ion);...|} else {|
|00003110| 0d 09 09 09 53 65 74 43 | 75 72 73 6f 72 28 26 71 |....SetC|ursor(&q|
|00003120| 64 2e 61 72 72 6f 77 29 | 3b 0d 09 09 09 43 6f 70 |d.arrow)|;....Cop|
|00003130| 79 52 67 6e 28 61 72 72 | 6f 77 52 67 6e 2c 20 72 |yRgn(arr|owRgn, r|
|00003140| 65 67 69 6f 6e 29 3b 0d | 09 09 7d 0d 0d 09 09 2f |egion);.|..}..../|
|00003150| 2a 20 67 65 74 20 72 69 | 64 20 6f 66 20 6f 75 72 |* get ri|d of our|
|00003160| 20 6c 6f 63 61 6c 20 72 | 65 67 69 6f 6e 73 20 2a | local r|egions *|
|00003170| 2f 0d 09 09 44 69 73 70 | 6f 73 65 52 67 6e 28 61 |/...Disp|oseRgn(a|
|00003180| 72 72 6f 77 52 67 6e 29 | 3b 0d 09 09 44 69 73 70 |rrowRgn)|;...Disp|
|00003190| 6f 73 65 52 67 6e 28 70 | 6c 75 73 52 67 6e 29 3b |oseRgn(p|lusRgn);|
|000031a0| 0d 09 7d 0d 7d 20 2f 2a | 41 64 6a 75 73 74 43 75 |..}.} /*|AdjustCu|
|000031b0| 72 73 6f 72 2a 2f 0d 0d | 0d 2f 2a 09 54 68 69 73 |rsor*/..|./*.This|
|000031c0| 20 69 73 20 63 61 6c 6c | 65 64 20 77 68 65 6e 20 | is call|ed when |
|000031d0| 61 6e 20 75 70 64 61 74 | 65 20 65 76 65 6e 74 20 |an updat|e event |
|000031e0| 69 73 20 72 65 63 65 69 | 76 65 64 20 66 6f 72 20 |is recei|ved for |
|000031f0| 61 20 77 69 6e 64 6f 77 | 2e 0d 09 49 74 20 63 61 |a window|...It ca|
|00003200| 6c 6c 73 20 44 72 61 77 | 57 69 6e 64 6f 77 20 74 |lls Draw|Window t|
|00003210| 6f 20 64 72 61 77 20 74 | 68 65 20 63 6f 6e 74 65 |o draw t|he conte|
|00003220| 6e 74 73 20 6f 66 20 61 | 6e 20 61 70 70 6c 69 63 |nts of a|n applic|
|00003230| 61 74 69 6f 6e 20 77 69 | 6e 64 6f 77 2e 0d 09 41 |ation wi|ndow...A|
|00003240| 73 20 61 6e 20 65 66 66 | 65 63 69 65 6e 63 79 20 |s an eff|eciency |
|00003250| 6d 65 61 73 75 72 65 20 | 74 68 61 74 20 64 6f 65 |measure |that doe|
|00003260| 73 20 6e 6f 74 20 68 61 | 76 65 20 74 6f 20 62 65 |s not ha|ve to be|
|00003270| 20 66 6f 6c 6c 6f 77 65 | 64 2c 20 69 74 0d 09 63 | followe|d, it..c|
|00003280| 61 6c 6c 73 20 74 68 65 | 20 64 72 61 77 69 6e 67 |alls the| drawing|
|00003290| 20 72 6f 75 74 69 6e 65 | 20 6f 6e 6c 79 20 69 66 | routine| only if|
|000032a0| 20 74 68 65 20 76 69 73 | 52 67 6e 20 69 73 20 6e | the vis|Rgn is n|
|000032b0| 6f 6e 2d 65 6d 70 74 79 | 2e 20 54 68 69 73 0d 09 |on-empty|. This..|
|000032c0| 77 69 6c 6c 20 68 61 6e | 64 6c 65 20 73 69 74 75 |will han|dle situ|
|000032d0| 61 74 69 6f 6e 73 20 77 | 68 65 72 65 20 63 61 6c |ations w|here cal|
|000032e0| 63 75 6c 61 74 69 6f 6e | 73 20 66 6f 72 20 64 72 |culation|s for dr|
|000032f0| 61 77 69 6e 67 20 6f 72 | 20 64 72 61 77 69 6e 67 |awing or| drawing|
|00003300| 0d 09 69 74 73 65 6c 66 | 20 69 73 20 76 65 72 79 |..itself| is very|
|00003310| 20 74 69 6d 65 2d 63 6f | 6e 73 75 6d 69 6e 67 2e | time-co|nsuming.|
|00003320| 20 2a 2f 0d 0d 23 64 65 | 66 69 6e 65 20 5f 5f 53 | */..#de|fine __S|
|00003330| 45 47 5f 5f 20 4d 61 69 | 6e 0d 76 6f 69 64 20 44 |EG__ Mai|n.void D|
|00003340| 6f 55 70 64 61 74 65 28 | 77 69 6e 64 6f 77 29 0d |oUpdate(|window).|
|00003350| 09 57 69 6e 64 6f 77 50 | 74 72 09 77 69 6e 64 6f |.WindowP|tr.windo|
|00003360| 77 3b 0d 7b 0d 09 69 66 | 20 28 20 49 73 41 70 70 |w;.{..if| ( IsApp|
|00003370| 57 69 6e 64 6f 77 28 77 | 69 6e 64 6f 77 29 20 29 |Window(w|indow) )|
|00003380| 20 7b 0d 09 09 42 65 67 | 69 6e 55 70 64 61 74 65 | {...Beg|inUpdate|
|00003390| 28 77 69 6e 64 6f 77 29 | 3b 09 09 09 09 2f 2a 20 |(window)|;..../* |
|000033a0| 74 68 69 73 20 73 65 74 | 73 20 75 70 20 74 68 65 |this set|s up the|
|000033b0| 20 76 69 73 52 67 6e 20 | 2a 2f 0d 09 09 69 66 20 | visRgn |*/...if |
|000033c0| 28 20 21 20 45 6d 70 74 | 79 52 67 6e 28 77 69 6e |( ! Empt|yRgn(win|
|000033d0| 64 6f 77 2d 3e 76 69 73 | 52 67 6e 29 20 29 09 2f |dow->vis|Rgn) )./|
|000033e0| 2a 20 64 72 61 77 20 69 | 66 20 75 70 64 61 74 69 |* draw i|f updati|
|000033f0| 6e 67 20 6e 65 65 64 73 | 20 74 6f 20 62 65 20 64 |ng needs| to be d|
|00003400| 6f 6e 65 20 2a 2f 0d 09 | 09 09 44 72 61 77 57 69 |one */..|..DrawWi|
|00003410| 6e 64 6f 77 28 77 69 6e | 64 6f 77 29 3b 0d 09 09 |ndow(win|dow);...|
|00003420| 45 6e 64 55 70 64 61 74 | 65 28 77 69 6e 64 6f 77 |EndUpdat|e(window|
|00003430| 29 3b 0d 09 7d 0d 7d 20 | 2f 2a 44 6f 55 70 64 61 |);..}.} |/*DoUpda|
|00003440| 74 65 2a 2f 0d 0d 0d 2f | 2a 09 54 68 69 73 20 69 |te*/.../|*.This i|
|00003450| 73 20 63 61 6c 6c 65 64 | 20 77 68 65 6e 20 61 20 |s called| when a |
|00003460| 77 69 6e 64 6f 77 20 69 | 73 20 61 63 74 69 76 61 |window i|s activa|
|00003470| 74 65 64 20 6f 72 20 64 | 65 61 63 74 69 76 61 74 |ted or d|eactivat|
|00003480| 65 64 2e 0d 09 49 6e 20 | 53 61 6d 70 6c 65 2c 20 |ed...In |Sample, |
|00003490| 74 68 65 20 57 69 6e 64 | 6f 77 20 4d 61 6e 61 67 |the Wind|ow Manag|
|000034a0| 65 72 27 73 20 68 61 6e | 64 6c 69 6e 67 20 6f 66 |er's han|dling of|
|000034b0| 20 61 63 74 69 76 61 74 | 65 20 61 6e 64 0d 09 64 | activat|e and..d|
|000034c0| 65 61 63 74 69 76 61 74 | 65 20 65 76 65 6e 74 73 |eactivat|e events|
|000034d0| 20 69 73 20 73 75 66 66 | 69 63 69 65 6e 74 2e 20 | is suff|icient. |
|000034e0| 4f 74 68 65 72 20 61 70 | 70 6c 69 63 61 74 69 6f |Other ap|plicatio|
|000034f0| 6e 73 20 6d 61 79 20 68 | 61 76 65 0d 09 54 65 78 |ns may h|ave..Tex|
|00003500| 74 45 64 69 74 20 72 65 | 63 6f 72 64 73 2c 20 63 |tEdit re|cords, c|
|00003510| 6f 6e 74 72 6f 6c 73 2c | 20 6c 69 73 74 73 2c 20 |ontrols,| lists, |
|00003520| 65 74 63 2e 2c 20 74 6f | 20 61 63 74 69 76 61 74 |etc., to| activat|
|00003530| 65 2f 64 65 61 63 74 69 | 76 61 74 65 2e 20 2a 2f |e/deacti|vate. */|
|00003540| 0d 0d 23 64 65 66 69 6e | 65 20 5f 5f 53 45 47 5f |..#defin|e __SEG_|
|00003550| 5f 20 4d 61 69 6e 0d 76 | 6f 69 64 20 44 6f 41 63 |_ Main.v|oid DoAc|
|00003560| 74 69 76 61 74 65 28 77 | 69 6e 64 6f 77 2c 20 62 |tivate(w|indow, b|
|00003570| 65 63 6f 6d 69 6e 67 41 | 63 74 69 76 65 29 0d 09 |ecomingA|ctive)..|
|00003580| 57 69 6e 64 6f 77 50 74 | 72 09 77 69 6e 64 6f 77 |WindowPt|r.window|
|00003590| 3b 0d 09 42 6f 6f 6c 65 | 61 6e 09 09 62 65 63 6f |;..Boole|an..beco|
|000035a0| 6d 69 6e 67 41 63 74 69 | 76 65 3b 0d 7b 0d 09 69 |mingActi|ve;.{..i|
|000035b0| 66 20 28 20 49 73 41 70 | 70 57 69 6e 64 6f 77 28 |f ( IsAp|pWindow(|
|000035c0| 77 69 6e 64 6f 77 29 20 | 29 20 7b 0d 09 09 69 66 |window) |) {...if|
|000035d0| 20 28 20 62 65 63 6f 6d | 69 6e 67 41 63 74 69 76 | ( becom|ingActiv|
|000035e0| 65 20 29 0d 09 09 09 2f | 2a 20 64 6f 20 77 68 61 |e )..../|* do wha|
|000035f0| 74 65 76 65 72 20 79 6f | 75 20 6e 65 65 64 20 74 |tever yo|u need t|
|00003600| 6f 20 61 74 20 61 63 74 | 69 76 61 74 69 6f 6e 20 |o at act|ivation |
|00003610| 2a 2f 20 3b 0d 09 09 65 | 6c 73 65 0d 09 09 09 2f |*/ ;...e|lse..../|
|00003620| 2a 20 64 6f 20 77 68 61 | 74 65 76 65 72 20 79 6f |* do wha|tever yo|
|00003630| 75 20 6e 65 65 64 20 74 | 6f 20 61 74 20 64 65 61 |u need t|o at dea|
|00003640| 63 74 69 76 61 74 69 6f | 6e 20 2a 2f 20 3b 0d 09 |ctivatio|n */ ;..|
|00003650| 7d 0d 7d 20 2f 2a 44 6f | 41 63 74 69 76 61 74 65 |}.} /*Do|Activate|
|00003660| 2a 2f 0d 0d 0d 2f 2a 09 | 54 68 69 73 20 69 73 20 |*/.../*.|This is |
|00003670| 63 61 6c 6c 65 64 20 77 | 68 65 6e 20 61 20 6d 6f |called w|hen a mo|
|00003680| 75 73 65 2d 64 6f 77 6e | 20 65 76 65 6e 74 20 6f |use-down| event o|
|00003690| 63 63 75 72 73 20 69 6e | 20 74 68 65 20 63 6f 6e |ccurs in| the con|
|000036a0| 74 65 6e 74 20 6f 66 20 | 61 20 77 69 6e 64 6f 77 |tent of |a window|
|000036b0| 2e 0d 09 4f 74 68 65 72 | 20 61 70 70 6c 69 63 61 |...Other| applica|
|000036c0| 74 69 6f 6e 73 20 6d 69 | 67 68 74 20 77 61 6e 74 |tions mi|ght want|
|000036d0| 20 74 6f 20 63 61 6c 6c | 20 46 69 6e 64 43 6f 6e | to call| FindCon|
|000036e0| 74 72 6f 6c 2c 20 54 45 | 43 6c 69 63 6b 2c 20 65 |trol, TE|Click, e|
|000036f0| 74 63 2e 2c 20 74 6f 0d | 09 66 75 72 74 68 65 72 |tc., to.|.further|
|00003700| 20 70 72 6f 63 65 73 73 | 20 74 68 65 20 63 6c 69 | process| the cli|
|00003710| 63 6b 2e 20 2a 2f 0d 0d | 23 64 65 66 69 6e 65 20 |ck. */..|#define |
|00003720| 5f 5f 53 45 47 5f 5f 20 | 4d 61 69 6e 0d 76 6f 69 |__SEG__ |Main.voi|
|00003730| 64 20 44 6f 43 6f 6e 74 | 65 6e 74 43 6c 69 63 6b |d DoCont|entClick|
|00003740| 28 77 69 6e 64 6f 77 29 | 0d 09 57 69 6e 64 6f 77 |(window)|..Window|
|00003750| 50 74 72 09 77 69 6e 64 | 6f 77 3b 0d 7b 0d 09 53 |Ptr.wind|ow;.{..S|
|00003760| 65 74 4c 69 67 68 74 28 | 77 69 6e 64 6f 77 2c 20 |etLight(|window, |
|00003770| 21 20 67 53 74 6f 70 70 | 65 64 29 3b 0d 7d 20 2f |! gStopp|ed);.} /|
|00003780| 2a 44 6f 43 6f 6e 74 65 | 6e 74 43 6c 69 63 6b 2a |*DoConte|ntClick*|
|00003790| 2f 0d 0d 0d 2f 2a 20 44 | 72 61 77 20 74 68 65 20 |/.../* D|raw the |
|000037a0| 63 6f 6e 74 65 6e 74 73 | 20 6f 66 20 74 68 65 20 |contents| of the |
|000037b0| 61 70 70 6c 69 63 61 74 | 69 6f 6e 20 77 69 6e 64 |applicat|ion wind|
|000037c0| 6f 77 2e 20 57 65 20 64 | 6f 20 73 6f 6d 65 20 64 |ow. We d|o some d|
|000037d0| 72 61 77 69 6e 67 20 69 | 6e 20 63 6f 6c 6f 72 2c |rawing i|n color,|
|000037e0| 20 75 73 69 6e 67 0d 20 | 20 20 43 6c 61 73 73 69 | using. | Classi|
|000037f0| 63 20 51 75 69 63 6b 44 | 72 61 77 27 73 20 63 6f |c QuickD|raw's co|
|00003800| 6c 6f 72 20 63 61 70 61 | 62 69 6c 69 74 69 65 73 |lor capa|bilities|
|00003810| 2e 20 54 68 69 73 20 77 | 69 6c 6c 20 62 65 20 62 |. This w|ill be b|
|00003820| 6c 61 63 6b 20 61 6e 64 | 20 77 68 69 74 65 20 6f |lack and| white o|
|00003830| 6e 20 6f 6c 64 0d 20 20 | 20 6d 61 63 68 69 6e 65 |n old. | machine|
|00003840| 73 2c 20 62 75 74 20 63 | 6f 6c 6f 72 20 6f 6e 20 |s, but c|olor on |
|00003850| 63 6f 6c 6f 72 20 6d 61 | 63 68 69 6e 65 73 2e 20 |color ma|chines. |
|00003860| 41 74 20 74 68 69 73 20 | 70 6f 69 6e 74 2c 20 74 |At this |point, t|
|00003870| 68 65 20 77 69 6e 64 6f | 77 d5 73 20 76 69 73 52 |he windo|w.s visR|
|00003880| 67 6e 0d 20 20 20 69 73 | 20 73 65 74 20 74 6f 20 |gn. is| set to |
|00003890| 61 6c 6c 6f 77 20 64 72 | 61 77 69 6e 67 20 6f 6e |allow dr|awing on|
|000038a0| 6c 79 20 77 68 65 72 65 | 20 69 74 20 6e 65 65 64 |ly where| it need|
|000038b0| 73 20 74 6f 20 62 65 20 | 64 6f 6e 65 2e 20 2a 2f |s to be |done. */|
|000038c0| 0d 0d 23 64 65 66 69 6e | 65 20 5f 5f 53 45 47 5f |..#defin|e __SEG_|
|000038d0| 5f 20 4d 61 69 6e 0d 76 | 6f 69 64 20 44 72 61 77 |_ Main.v|oid Draw|
|000038e0| 57 69 6e 64 6f 77 28 77 | 69 6e 64 6f 77 29 0d 09 |Window(w|indow)..|
|000038f0| 57 69 6e 64 6f 77 50 74 | 72 09 77 69 6e 64 6f 77 |WindowPt|r.window|
|00003900| 3b 0d 7b 0d 09 53 65 74 | 50 6f 72 74 28 77 69 6e |;.{..Set|Port(win|
|00003910| 64 6f 77 29 3b 0d 0d 09 | 45 72 61 73 65 52 65 63 |dow);...|EraseRec|
|00003920| 74 28 26 77 69 6e 64 6f | 77 2d 3e 70 6f 72 74 52 |t(&windo|w->portR|
|00003930| 65 63 74 29 3b 09 2f 2a | 20 63 6c 65 61 72 20 6f |ect);./*| clear o|
|00003940| 75 74 20 61 6e 79 20 67 | 61 72 62 61 67 65 20 74 |ut any g|arbage t|
|00003950| 68 61 74 20 6d 61 79 20 | 6c 69 6e 67 65 72 20 2a |hat may |linger *|
|00003960| 2f 0d 09 69 66 20 28 20 | 67 53 74 6f 70 70 65 64 |/..if ( |gStopped|
|00003970| 20 29 09 09 09 09 09 2f | 2a 20 64 72 61 77 20 61 | )...../|* draw a|
|00003980| 20 72 65 64 20 28 6f 72 | 20 77 68 69 74 65 29 20 | red (or| white) |
|00003990| 73 74 6f 70 20 6c 69 67 | 68 74 20 2a 2f 0d 09 09 |stop lig|ht */...|
|000039a0| 46 6f 72 65 43 6f 6c 6f | 72 28 72 65 64 43 6f 6c |ForeColo|r(redCol|
|000039b0| 6f 72 29 3b 0d 09 65 6c | 73 65 0d 09 09 46 6f 72 |or);..el|se...For|
|000039c0| 65 43 6f 6c 6f 72 28 77 | 68 69 74 65 43 6f 6c 6f |eColor(w|hiteColo|
|000039d0| 72 29 3b 0d 09 50 61 69 | 6e 74 4f 76 61 6c 28 26 |r);..Pai|ntOval(&|
|000039e0| 67 53 74 6f 70 52 65 63 | 74 29 3b 0d 09 46 6f 72 |gStopRec|t);..For|
|000039f0| 65 43 6f 6c 6f 72 28 62 | 6c 61 63 6b 43 6f 6c 6f |eColor(b|lackColo|
|00003a00| 72 29 3b 0d 09 46 72 61 | 6d 65 4f 76 61 6c 28 26 |r);..Fra|meOval(&|
|00003a10| 67 53 74 6f 70 52 65 63 | 74 29 3b 0d 09 69 66 20 |gStopRec|t);..if |
|00003a20| 28 20 21 20 67 53 74 6f | 70 70 65 64 20 29 09 09 |( ! gSto|pped )..|
|00003a30| 09 09 2f 2a 20 64 72 61 | 77 20 61 20 67 72 65 65 |../* dra|w a gree|
|00003a40| 6e 20 28 6f 72 20 77 68 | 69 74 65 29 20 67 6f 20 |n (or wh|ite) go |
|00003a50| 6c 69 67 68 74 20 2a 2f | 0d 09 09 46 6f 72 65 43 |light */|...ForeC|
|00003a60| 6f 6c 6f 72 28 67 72 65 | 65 6e 43 6f 6c 6f 72 29 |olor(gre|enColor)|
|00003a70| 3b 0d 09 65 6c 73 65 0d | 09 09 46 6f 72 65 43 6f |;..else.|..ForeCo|
|00003a80| 6c 6f 72 28 77 68 69 74 | 65 43 6f 6c 6f 72 29 3b |lor(whit|eColor);|
|00003a90| 0d 09 50 61 69 6e 74 4f | 76 61 6c 28 26 67 47 6f |..PaintO|val(&gGo|
|00003aa0| 52 65 63 74 29 3b 0d 09 | 46 6f 72 65 43 6f 6c 6f |Rect);..|ForeColo|
|00003ab0| 72 28 62 6c 61 63 6b 43 | 6f 6c 6f 72 29 3b 0d 09 |r(blackC|olor);..|
|00003ac0| 46 72 61 6d 65 4f 76 61 | 6c 28 26 67 47 6f 52 65 |FrameOva|l(&gGoRe|
|00003ad0| 63 74 29 3b 0d 7d 20 2f | 2a 44 72 61 77 57 69 6e |ct);.} /|*DrawWin|
|00003ae0| 64 6f 77 2a 2f 0d 0d 0d | 2f 2a 09 45 6e 61 62 6c |dow*/...|/*.Enabl|
|00003af0| 65 20 61 6e 64 20 64 69 | 73 61 62 6c 65 20 6d 65 |e and di|sable me|
|00003b00| 6e 75 73 20 62 61 73 65 | 64 20 6f 6e 20 74 68 65 |nus base|d on the|
|00003b10| 20 63 75 72 72 65 6e 74 | 20 73 74 61 74 65 2e 0d | current| state..|
|00003b20| 09 54 68 65 20 75 73 65 | 72 20 63 61 6e 20 6f 6e |.The use|r can on|
|00003b30| 6c 79 20 73 65 6c 65 63 | 74 20 65 6e 61 62 6c 65 |ly selec|t enable|
|00003b40| 64 20 6d 65 6e 75 20 69 | 74 65 6d 73 2e 20 57 65 |d menu i|tems. We|
|00003b50| 20 73 65 74 20 75 70 20 | 61 6c 6c 20 74 68 65 20 | set up |all the |
|00003b60| 6d 65 6e 75 20 69 74 65 | 6d 73 0d 09 62 65 66 6f |menu ite|ms..befo|
|00003b70| 72 65 20 63 61 6c 6c 69 | 6e 67 20 4d 65 6e 75 53 |re calli|ng MenuS|
|00003b80| 65 6c 65 63 74 20 6f 72 | 20 4d 65 6e 75 4b 65 79 |elect or| MenuKey|
|00003b90| 2c 20 73 69 6e 63 65 20 | 74 68 65 73 65 20 61 72 |, since |these ar|
|00003ba0| 65 20 74 68 65 20 6f 6e | 6c 79 20 74 69 6d 65 73 |e the on|ly times|
|00003bb0| 20 74 68 61 74 0d 09 61 | 20 6d 65 6e 75 20 69 74 | that..a| menu it|
|00003bc0| 65 6d 20 63 61 6e 20 62 | 65 20 73 65 6c 65 63 74 |em can b|e select|
|00003bd0| 65 64 2e 20 4e 6f 74 65 | 20 74 68 61 74 20 4d 65 |ed. Note| that Me|
|00003be0| 6e 75 53 65 6c 65 63 74 | 20 69 73 20 61 6c 73 6f |nuSelect| is also|
|00003bf0| 20 74 68 65 20 6f 6e 6c | 79 20 74 69 6d 65 0d 09 | the onl|y time..|
|00003c00| 74 68 65 20 75 73 65 72 | 20 77 69 6c 6c 20 73 65 |the user| will se|
|00003c10| 65 20 6d 65 6e 75 20 69 | 74 65 6d 73 2e 20 54 68 |e menu i|tems. Th|
|00003c20| 69 73 20 61 70 70 72 6f | 61 63 68 20 74 6f 20 64 |is appro|ach to d|
|00003c30| 65 63 69 64 69 6e 67 20 | 77 68 61 74 20 65 6e 61 |eciding |what ena|
|00003c40| 62 6c 65 2f 0d 09 64 69 | 73 61 62 6c 65 20 73 74 |ble/..di|sable st|
|00003c50| 61 74 65 20 61 20 6d 65 | 6e 75 20 69 74 65 6d 20 |ate a me|nu item |
|00003c60| 68 61 73 20 74 68 65 20 | 61 64 76 61 6e 74 61 67 |has the |advantag|
|00003c70| 65 20 6f 66 20 63 6f 6e | 63 65 6e 74 72 61 74 69 |e of con|centrati|
|00003c80| 6e 67 20 61 6c 6c 0d 09 | 74 68 65 20 64 65 63 69 |ng all..|the deci|
|00003c90| 73 69 6f 6e 2d 6d 61 6b | 69 6e 67 20 69 6e 20 6f |sion-mak|ing in o|
|00003ca0| 6e 65 20 72 6f 75 74 69 | 6e 65 2c 20 61 73 20 6f |ne routi|ne, as o|
|00003cb0| 70 70 6f 73 65 64 20 74 | 6f 20 62 65 69 6e 67 20 |pposed t|o being |
|00003cc0| 73 70 72 65 61 64 20 74 | 68 72 6f 75 67 68 6f 75 |spread t|hroughou|
|00003cd0| 74 0d 09 74 68 65 20 61 | 70 70 6c 69 63 61 74 69 |t..the a|pplicati|
|00003ce0| 6f 6e 2e 20 4f 74 68 65 | 72 20 61 70 70 6c 69 63 |on. Othe|r applic|
|00003cf0| 61 74 69 6f 6e 20 64 65 | 73 69 67 6e 73 20 6d 61 |ation de|signs ma|
|00003d00| 79 20 74 61 6b 65 20 61 | 20 64 69 66 66 65 72 65 |y take a| differe|
|00003d10| 6e 74 20 61 70 70 72 6f | 61 63 68 0d 09 74 68 61 |nt appro|ach..tha|
|00003d20| 74 20 69 73 20 6a 75 73 | 74 20 61 73 20 76 61 6c |t is jus|t as val|
|00003d30| 69 64 2e 20 2a 2f 0d 0d | 23 64 65 66 69 6e 65 20 |id. */..|#define |
|00003d40| 5f 5f 53 45 47 5f 5f 20 | 4d 61 69 6e 0d 76 6f 69 |__SEG__ |Main.voi|
|00003d50| 64 20 41 64 6a 75 73 74 | 4d 65 6e 75 73 28 29 0d |d Adjust|Menus().|
|00003d60| 7b 0d 09 57 69 6e 64 6f | 77 50 74 72 09 77 69 6e |{..Windo|wPtr.win|
|00003d70| 64 6f 77 3b 0d 09 4d 65 | 6e 75 48 61 6e 64 6c 65 |dow;..Me|nuHandle|
|00003d80| 09 6d 65 6e 75 3b 0d 0d | 09 77 69 6e 64 6f 77 20 |.menu;..|.window |
|00003d90| 3d 20 46 72 6f 6e 74 57 | 69 6e 64 6f 77 28 29 3b |= FrontW|indow();|
|00003da0| 0d 0d 09 6d 65 6e 75 20 | 3d 20 47 65 74 4d 48 61 |...menu |= GetMHa|
|00003db0| 6e 64 6c 65 28 6d 46 69 | 6c 65 29 3b 0d 09 69 66 |ndle(mFi|le);..if|
|00003dc0| 20 28 20 49 73 44 41 57 | 69 6e 64 6f 77 28 77 69 | ( IsDAW|indow(wi|
|00003dd0| 6e 64 6f 77 29 20 29 09 | 09 2f 2a 20 77 65 20 63 |ndow) ).|./* we c|
|00003de0| 61 6e 20 61 6c 6c 6f 77 | 20 64 65 73 6b 20 61 63 |an allow| desk ac|
|00003df0| 63 65 73 73 6f 72 69 65 | 73 20 74 6f 20 62 65 20 |cessorie|s to be |
|00003e00| 63 6c 6f 73 65 64 20 66 | 72 6f 6d 20 74 68 65 20 |closed f|rom the |
|00003e10| 6d 65 6e 75 20 2a 2f 0d | 09 09 45 6e 61 62 6c 65 |menu */.|..Enable|
|00003e20| 49 74 65 6d 28 6d 65 6e | 75 2c 20 69 43 6c 6f 73 |Item(men|u, iClos|
|00003e30| 65 29 3b 0d 09 65 6c 73 | 65 0d 09 09 44 69 73 61 |e);..els|e...Disa|
|00003e40| 62 6c 65 49 74 65 6d 28 | 6d 65 6e 75 2c 20 69 43 |bleItem(|menu, iC|
|00003e50| 6c 6f 73 65 29 3b 09 2f | 2a 20 62 75 74 20 6e 6f |lose);./|* but no|
|00003e60| 74 20 6f 75 72 20 74 72 | 61 66 66 69 63 20 6c 69 |t our tr|affic li|
|00003e70| 67 68 74 20 77 69 6e 64 | 6f 77 20 2a 2f 0d 0d 09 |ght wind|ow */...|
|00003e80| 6d 65 6e 75 20 3d 20 47 | 65 74 4d 48 61 6e 64 6c |menu = G|etMHandl|
|00003e90| 65 28 6d 45 64 69 74 29 | 3b 0d 09 69 66 20 28 20 |e(mEdit)|;..if ( |
|00003ea0| 49 73 44 41 57 69 6e 64 | 6f 77 28 77 69 6e 64 6f |IsDAWind|ow(windo|
|00003eb0| 77 29 20 29 20 7b 09 09 | 2f 2a 20 61 20 64 65 73 |w) ) {..|/* a des|
|00003ec0| 6b 20 61 63 63 65 73 73 | 6f 72 79 20 6d 69 67 68 |k access|ory migh|
|00003ed0| 74 20 6e 65 65 64 20 74 | 68 65 20 65 64 69 74 20 |t need t|he edit |
|00003ee0| 6d 65 6e 75 c9 20 2a 2f | 0d 09 09 45 6e 61 62 6c |menu. */|...Enabl|
|00003ef0| 65 49 74 65 6d 28 6d 65 | 6e 75 2c 20 69 55 6e 64 |eItem(me|nu, iUnd|
|00003f00| 6f 29 3b 0d 09 09 45 6e | 61 62 6c 65 49 74 65 6d |o);...En|ableItem|
|00003f10| 28 6d 65 6e 75 2c 20 69 | 43 75 74 29 3b 0d 09 09 |(menu, i|Cut);...|
|00003f20| 45 6e 61 62 6c 65 49 74 | 65 6d 28 6d 65 6e 75 2c |EnableIt|em(menu,|
|00003f30| 20 69 43 6f 70 79 29 3b | 0d 09 09 45 6e 61 62 6c | iCopy);|...Enabl|
|00003f40| 65 49 74 65 6d 28 6d 65 | 6e 75 2c 20 69 43 6c 65 |eItem(me|nu, iCle|
|00003f50| 61 72 29 3b 0d 09 09 45 | 6e 61 62 6c 65 49 74 65 |ar);...E|nableIte|
|00003f60| 6d 28 6d 65 6e 75 2c 20 | 69 50 61 73 74 65 29 3b |m(menu, |iPaste);|
|00003f70| 0d 09 7d 20 65 6c 73 65 | 20 7b 09 09 09 09 09 09 |..} else| {......|
|00003f80| 2f 2a 20 c9 62 75 74 20 | 77 65 20 64 6f 6e d5 74 |/* .but |we don.t|
|00003f90| 20 75 73 65 20 69 74 20 | 2a 2f 0d 09 09 44 69 73 | use it |*/...Dis|
|00003fa0| 61 62 6c 65 49 74 65 6d | 28 6d 65 6e 75 2c 20 69 |ableItem|(menu, i|
|00003fb0| 55 6e 64 6f 29 3b 0d 09 | 09 44 69 73 61 62 6c 65 |Undo);..|.Disable|
|00003fc0| 49 74 65 6d 28 6d 65 6e | 75 2c 20 69 43 75 74 29 |Item(men|u, iCut)|
|00003fd0| 3b 0d 09 09 44 69 73 61 | 62 6c 65 49 74 65 6d 28 |;...Disa|bleItem(|
|00003fe0| 6d 65 6e 75 2c 20 69 43 | 6f 70 79 29 3b 0d 09 09 |menu, iC|opy);...|
|00003ff0| 44 69 73 61 62 6c 65 49 | 74 65 6d 28 6d 65 6e 75 |DisableI|tem(menu|
|00004000| 2c 20 69 43 6c 65 61 72 | 29 3b 0d 09 09 44 69 73 |, iClear|);...Dis|
|00004010| 61 62 6c 65 49 74 65 6d | 28 6d 65 6e 75 2c 20 69 |ableItem|(menu, i|
|00004020| 50 61 73 74 65 29 3b 0d | 09 7d 0d 0d 09 6d 65 6e |Paste);.|.}...men|
|00004030| 75 20 3d 20 47 65 74 4d | 48 61 6e 64 6c 65 28 6d |u = GetM|Handle(m|
|00004040| 4c 69 67 68 74 29 3b 0d | 09 69 66 20 28 20 49 73 |Light);.|.if ( Is|
|00004050| 41 70 70 57 69 6e 64 6f | 77 28 77 69 6e 64 6f 77 |AppWindo|w(window|
|00004060| 29 20 29 20 7b 09 2f 2a | 20 77 65 20 6b 6e 6f 77 |) ) {./*| we know|
|00004070| 20 74 68 61 74 20 69 74 | 20 6d 75 73 74 20 62 65 | that it| must be|
|00004080| 20 74 68 65 20 74 72 61 | 66 66 69 63 20 6c 69 67 | the tra|ffic lig|
|00004090| 68 74 20 2a 2f 0d 09 09 | 45 6e 61 62 6c 65 49 74 |ht */...|EnableIt|
|000040a0| 65 6d 28 6d 65 6e 75 2c | 20 69 53 74 6f 70 29 3b |em(menu,| iStop);|
|000040b0| 0d 09 09 45 6e 61 62 6c | 65 49 74 65 6d 28 6d 65 |...Enabl|eItem(me|
|000040c0| 6e 75 2c 20 69 47 6f 29 | 3b 0d 09 7d 20 65 6c 73 |nu, iGo)|;..} els|
|000040d0| 65 20 7b 0d 09 09 44 69 | 73 61 62 6c 65 49 74 65 |e {...Di|sableIte|
|000040e0| 6d 28 6d 65 6e 75 2c 20 | 69 53 74 6f 70 29 3b 0d |m(menu, |iStop);.|
|000040f0| 09 09 44 69 73 61 62 6c | 65 49 74 65 6d 28 6d 65 |..Disabl|eItem(me|
|00004100| 6e 75 2c 20 69 47 6f 29 | 3b 0d 09 7d 0d 09 43 68 |nu, iGo)|;..}..Ch|
|00004110| 65 63 6b 49 74 65 6d 28 | 6d 65 6e 75 2c 20 69 53 |eckItem(|menu, iS|
|00004120| 74 6f 70 2c 20 67 53 74 | 6f 70 70 65 64 29 3b 20 |top, gSt|opped); |
|00004130| 2f 2a 20 77 65 20 63 61 | 6e 20 61 6c 73 6f 20 64 |/* we ca|n also d|
|00004140| 65 74 65 72 6d 69 6e 65 | 20 63 68 65 63 6b 2f 75 |etermine| check/u|
|00004150| 6e 63 68 65 63 6b 20 73 | 74 61 74 65 2c 20 74 6f |ncheck s|tate, to|
|00004160| 6f 20 2a 2f 0d 09 43 68 | 65 63 6b 49 74 65 6d 28 |o */..Ch|eckItem(|
|00004170| 6d 65 6e 75 2c 20 69 47 | 6f 2c 20 21 20 67 53 74 |menu, iG|o, ! gSt|
|00004180| 6f 70 70 65 64 29 3b 0d | 7d 20 2f 2a 41 64 6a 75 |opped);.|} /*Adju|
|00004190| 73 74 4d 65 6e 75 73 2a | 2f 0d 0d 0d 2f 2a 09 54 |stMenus*|/.../*.T|
|000041a0| 68 69 73 20 69 73 20 63 | 61 6c 6c 65 64 20 77 68 |his is c|alled wh|
|000041b0| 65 6e 20 61 6e 20 69 74 | 65 6d 20 69 73 20 63 68 |en an it|em is ch|
|000041c0| 6f 73 65 6e 20 66 72 6f | 6d 20 74 68 65 20 6d 65 |osen fro|m the me|
|000041d0| 6e 75 20 62 61 72 20 28 | 61 66 74 65 72 20 63 61 |nu bar (|after ca|
|000041e0| 6c 6c 69 6e 67 0d 09 4d | 65 6e 75 53 65 6c 65 63 |lling..M|enuSelec|
|000041f0| 74 20 6f 72 20 4d 65 6e | 75 4b 65 79 29 2e 20 49 |t or Men|uKey). I|
|00004200| 74 20 70 65 72 66 6f 72 | 6d 73 20 74 68 65 20 72 |t perfor|ms the r|
|00004210| 69 67 68 74 20 6f 70 65 | 72 61 74 69 6f 6e 20 66 |ight ope|ration f|
|00004220| 6f 72 20 65 61 63 68 20 | 63 6f 6d 6d 61 6e 64 2e |or each |command.|
|00004230| 0d 09 49 74 20 69 73 20 | 67 6f 6f 64 20 74 6f 20 |..It is |good to |
|00004240| 68 61 76 65 20 62 6f 74 | 68 20 74 68 65 20 72 65 |have bot|h the re|
|00004250| 73 75 6c 74 20 6f 66 20 | 4d 65 6e 75 53 65 6c 65 |sult of |MenuSele|
|00004260| 63 74 20 61 6e 64 20 4d | 65 6e 75 4b 65 79 20 67 |ct and M|enuKey g|
|00004270| 6f 20 74 6f 0d 09 6f 6e | 65 20 72 6f 75 74 69 6e |o to..on|e routin|
|00004280| 65 20 6c 69 6b 65 20 74 | 68 69 73 20 74 6f 20 6b |e like t|his to k|
|00004290| 65 65 70 20 65 76 65 72 | 79 74 68 69 6e 67 20 6f |eep ever|ything o|
|000042a0| 72 67 61 6e 69 7a 65 64 | 2e 20 2a 2f 0d 0d 23 64 |rganized|. */..#d|
|000042b0| 65 66 69 6e 65 20 5f 5f | 53 45 47 5f 5f 20 4d 61 |efine __|SEG__ Ma|
|000042c0| 69 6e 0d 76 6f 69 64 20 | 44 6f 4d 65 6e 75 43 6f |in.void |DoMenuCo|
|000042d0| 6d 6d 61 6e 64 28 6d 65 | 6e 75 52 65 73 75 6c 74 |mmand(me|nuResult|
|000042e0| 29 0d 09 6c 6f 6e 67 09 | 09 6d 65 6e 75 52 65 73 |)..long.|.menuRes|
|000042f0| 75 6c 74 3b 0d 7b 0d 09 | 73 68 6f 72 74 09 09 6d |ult;.{..|short..m|
|00004300| 65 6e 75 49 44 3b 09 09 | 09 09 2f 2a 20 74 68 65 |enuID;..|../* the|
|00004310| 20 72 65 73 6f 75 72 63 | 65 20 49 44 20 6f 66 20 | resourc|e ID of |
|00004320| 74 68 65 20 73 65 6c 65 | 63 74 65 64 20 6d 65 6e |the sele|cted men|
|00004330| 75 20 2a 2f 0d 09 73 68 | 6f 72 74 09 09 6d 65 6e |u */..sh|ort..men|
|00004340| 75 49 74 65 6d 3b 09 09 | 09 2f 2a 20 74 68 65 20 |uItem;..|./* the |
|00004350| 69 74 65 6d 20 6e 75 6d | 62 65 72 20 6f 66 20 74 |item num|ber of t|
|00004360| 68 65 20 73 65 6c 65 63 | 74 65 64 20 6d 65 6e 75 |he selec|ted menu|
|00004370| 20 2a 2f 0d 09 73 68 6f | 72 74 09 09 69 74 65 6d | */..sho|rt..item|
|00004380| 48 69 74 3b 0d 09 53 74 | 72 32 35 35 09 09 64 61 |Hit;..St|r255..da|
|00004390| 4e 61 6d 65 3b 0d 09 73 | 68 6f 72 74 09 09 64 61 |Name;..s|hort..da|
|000043a0| 52 65 66 4e 75 6d 3b 0d | 09 42 6f 6f 6c 65 61 6e |RefNum;.|.Boolean|
|000043b0| 09 09 68 61 6e 64 6c 65 | 64 42 79 44 41 3b 0d 0d |..handle|dByDA;..|
|000043c0| 09 6d 65 6e 75 49 44 20 | 3d 20 48 69 57 6f 72 64 |.menuID |= HiWord|
|000043d0| 28 6d 65 6e 75 52 65 73 | 75 6c 74 29 3b 09 2f 2a |(menuRes|ult);./*|
|000043e0| 20 75 73 65 20 6d 61 63 | 72 6f 73 20 66 6f 72 20 | use mac|ros for |
|000043f0| 65 66 66 69 63 69 65 6e | 63 79 20 74 6f 2e 2e 2e |efficien|cy to...|
|00004400| 20 2a 2f 0d 09 6d 65 6e | 75 49 74 65 6d 20 3d 20 | */..men|uItem = |
|00004410| 4c 6f 57 6f 72 64 28 6d | 65 6e 75 52 65 73 75 6c |LoWord(m|enuResul|
|00004420| 74 29 3b 09 2f 2a 20 67 | 65 74 20 6d 65 6e 75 20 |t);./* g|et menu |
|00004430| 69 74 65 6d 20 6e 75 6d | 62 65 72 20 61 6e 64 20 |item num|ber and |
|00004440| 6d 65 6e 75 20 6e 75 6d | 62 65 72 20 2a 2f 0d 09 |menu num|ber */..|
|00004450| 73 77 69 74 63 68 20 28 | 20 6d 65 6e 75 49 44 20 |switch (| menuID |
|00004460| 29 20 7b 0d 09 09 63 61 | 73 65 20 6d 41 70 70 6c |) {...ca|se mAppl|
|00004470| 65 3a 0d 09 09 09 73 77 | 69 74 63 68 20 28 20 6d |e:....sw|itch ( m|
|00004480| 65 6e 75 49 74 65 6d 20 | 29 20 7b 0d 09 09 09 09 |enuItem |) {.....|
|00004490| 63 61 73 65 20 69 41 62 | 6f 75 74 3a 09 09 2f 2a |case iAb|out:../*|
|000044a0| 20 62 72 69 6e 67 20 75 | 70 20 61 6c 65 72 74 20 | bring u|p alert |
|000044b0| 66 6f 72 20 41 62 6f 75 | 74 20 2a 2f 0d 09 09 09 |for Abou|t */....|
|000044c0| 09 09 69 74 65 6d 48 69 | 74 20 3d 20 41 6c 65 72 |..itemHi|t = Aler|
|000044d0| 74 28 72 41 62 6f 75 74 | 41 6c 65 72 74 2c 20 6e |t(rAbout|Alert, n|
|000044e0| 69 6c 29 3b 0d 09 09 09 | 09 09 62 72 65 61 6b 3b |il);....|..break;|
|000044f0| 0d 09 09 09 09 64 65 66 | 61 75 6c 74 3a 09 09 09 |.....def|ault:...|
|00004500| 2f 2a 20 61 6c 6c 20 6e | 6f 6e 2d 41 62 6f 75 74 |/* all n|on-About|
|00004510| 20 69 74 65 6d 73 20 69 | 6e 20 74 68 69 73 20 6d | items i|n this m|
|00004520| 65 6e 75 20 61 72 65 20 | 44 41 73 20 2a 2f 0d 23 |enu are |DAs */.#|
|00004530| 09 09 09 09 09 69 66 6e | 64 65 66 20 4d 50 57 33 |.....ifn|def MPW3|
|00004540| 0d 09 09 09 09 09 09 2f | 2a 20 74 79 70 65 20 53 |......./|* type S|
|00004550| 74 72 32 35 35 20 69 73 | 20 61 20 73 74 72 75 63 |tr255 is| a struc|
|00004560| 74 20 69 6e 20 4d 50 57 | 20 32 20 2a 2f 0d 09 09 |t in MPW| 2 */...|
|00004570| 09 09 09 09 47 45 54 49 | 54 45 4d 28 47 65 74 4d |....GETI|TEM(GetM|
|00004580| 48 61 6e 64 6c 65 28 6d | 41 70 70 6c 65 29 2c 20 |Handle(m|Apple), |
|00004590| 6d 65 6e 75 49 74 65 6d | 2c 20 26 64 61 4e 61 6d |menuItem|, &daNam|
|000045a0| 65 29 3b 0d 09 09 09 09 | 09 09 64 61 52 65 66 4e |e);.....|..daRefN|
|000045b0| 75 6d 20 3d 20 4f 50 45 | 4e 44 45 53 4b 41 43 43 |um = OPE|NDESKACC|
|000045c0| 28 26 64 61 4e 61 6d 65 | 29 3b 0d 23 09 09 09 09 |(&daName|);.#....|
|000045d0| 09 65 6c 73 65 0d 09 09 | 09 09 09 09 2f 2a 20 74 |.else...|..../* t|
|000045e0| 79 70 65 20 53 74 72 32 | 35 35 20 69 73 20 61 6e |ype Str2|55 is an|
|000045f0| 20 61 72 72 61 79 20 69 | 6e 20 4d 50 57 20 33 20 | array i|n MPW 3 |
|00004600| 2a 2f 0d 09 09 09 09 09 | 09 47 65 74 49 74 65 6d |*/......|.GetItem|
|00004610| 28 47 65 74 4d 48 61 6e | 64 6c 65 28 6d 41 70 70 |(GetMHan|dle(mApp|
|00004620| 6c 65 29 2c 20 6d 65 6e | 75 49 74 65 6d 2c 20 64 |le), men|uItem, d|
|00004630| 61 4e 61 6d 65 29 3b 0d | 09 09 09 09 09 09 64 61 |aName);.|......da|
|00004640| 52 65 66 4e 75 6d 20 3d | 20 4f 70 65 6e 44 65 73 |RefNum =| OpenDes|
|00004650| 6b 41 63 63 28 64 61 4e | 61 6d 65 29 3b 0d 23 09 |kAcc(daN|ame);.#.|
|00004660| 09 09 09 09 65 6e 64 69 | 66 0d 09 09 09 09 09 62 |....endi|f......b|
|00004670| 72 65 61 6b 3b 0d 09 09 | 09 7d 0d 09 09 09 62 72 |reak;...|.}....br|
|00004680| 65 61 6b 3b 0d 09 09 63 | 61 73 65 20 6d 46 69 6c |eak;...c|ase mFil|
|00004690| 65 3a 0d 09 09 09 73 77 | 69 74 63 68 20 28 20 6d |e:....sw|itch ( m|
|000046a0| 65 6e 75 49 74 65 6d 20 | 29 20 7b 0d 09 09 09 09 |enuItem |) {.....|
|000046b0| 63 61 73 65 20 69 43 6c | 6f 73 65 3a 0d 09 09 09 |case iCl|ose:....|
|000046c0| 09 09 44 6f 43 6c 6f 73 | 65 57 69 6e 64 6f 77 28 |..DoClos|eWindow(|
|000046d0| 46 72 6f 6e 74 57 69 6e | 64 6f 77 28 29 29 3b 0d |FrontWin|dow());.|
|000046e0| 09 09 09 09 09 62 72 65 | 61 6b 3b 0d 09 09 09 09 |.....bre|ak;.....|
|000046f0| 63 61 73 65 20 69 51 75 | 69 74 3a 0d 09 09 09 09 |case iQu|it:.....|
|00004700| 09 54 65 72 6d 69 6e 61 | 74 65 28 29 3b 0d 09 09 |.Termina|te();...|
|00004710| 09 09 09 62 72 65 61 6b | 3b 0d 09 09 09 7d 0d 09 |...break|;....}..|
|00004720| 09 09 62 72 65 61 6b 3b | 0d 09 09 63 61 73 65 20 |..break;|...case |
|00004730| 6d 45 64 69 74 3a 09 09 | 09 09 09 2f 2a 20 63 61 |mEdit:..|.../* ca|
|00004740| 6c 6c 20 53 79 73 74 65 | 6d 45 64 69 74 20 66 6f |ll Syste|mEdit fo|
|00004750| 72 20 44 41 20 65 64 69 | 74 69 6e 67 20 26 20 4d |r DA edi|ting & M|
|00004760| 75 6c 74 69 46 69 6e 64 | 65 72 20 2a 2f 0d 09 09 |ultiFind|er */...|
|00004770| 09 68 61 6e 64 6c 65 64 | 42 79 44 41 20 3d 20 53 |.handled|ByDA = S|
|00004780| 79 73 74 65 6d 45 64 69 | 74 28 6d 65 6e 75 49 74 |ystemEdi|t(menuIt|
|00004790| 65 6d 2d 31 29 3b 09 2f | 2a 20 73 69 6e 63 65 20 |em-1);./|* since |
|000047a0| 77 65 20 64 6f 6e d5 74 | 20 64 6f 20 61 6e 79 20 |we don.t| do any |
|000047b0| 45 64 69 74 69 6e 67 20 | 2a 2f 0d 09 09 09 62 72 |Editing |*/....br|
|000047c0| 65 61 6b 3b 0d 09 09 63 | 61 73 65 20 6d 4c 69 67 |eak;...c|ase mLig|
|000047d0| 68 74 3a 0d 09 09 09 73 | 77 69 74 63 68 20 28 20 |ht:....s|witch ( |
|000047e0| 6d 65 6e 75 49 74 65 6d | 20 29 20 7b 0d 09 09 09 |menuItem| ) {....|
|000047f0| 09 63 61 73 65 20 69 53 | 74 6f 70 3a 0d 09 09 09 |.case iS|top:....|
|00004800| 09 09 53 65 74 4c 69 67 | 68 74 28 46 72 6f 6e 74 |..SetLig|ht(Front|
|00004810| 57 69 6e 64 6f 77 28 29 | 2c 20 74 72 75 65 29 3b |Window()|, true);|
|00004820| 0d 09 09 09 09 09 62 72 | 65 61 6b 3b 0d 09 09 09 |......br|eak;....|
|00004830| 09 63 61 73 65 20 69 47 | 6f 3a 0d 09 09 09 09 09 |.case iG|o:......|
|00004840| 53 65 74 4c 69 67 68 74 | 28 46 72 6f 6e 74 57 69 |SetLight|(FrontWi|
|00004850| 6e 64 6f 77 28 29 2c 20 | 66 61 6c 73 65 29 3b 0d |ndow(), |false);.|
|00004860| 09 09 09 09 09 62 72 65 | 61 6b 3b 0d 09 09 09 7d |.....bre|ak;....}|
|00004870| 0d 09 09 09 62 72 65 61 | 6b 3b 0d 09 7d 0d 09 48 |....brea|k;..}..H|
|00004880| 69 6c 69 74 65 4d 65 6e | 75 28 30 29 3b 09 09 09 |iliteMen|u(0);...|
|00004890| 09 09 2f 2a 20 75 6e 68 | 69 67 68 6c 69 67 68 74 |../* unh|ighlight|
|000048a0| 20 77 68 61 74 20 4d 65 | 6e 75 53 65 6c 65 63 74 | what Me|nuSelect|
|000048b0| 20 28 6f 72 20 4d 65 6e | 75 4b 65 79 29 20 68 69 | (or Men|uKey) hi|
|000048c0| 6c 69 74 65 64 20 2a 2f | 0d 7d 20 2f 2a 44 6f 4d |lited */|.} /*DoM|
|000048d0| 65 6e 75 43 6f 6d 6d 61 | 6e 64 2a 2f 0d 0d 0d 2f |enuComma|nd*/.../|
|000048e0| 2a 20 43 68 61 6e 67 65 | 20 74 68 65 20 73 65 74 |* Change| the set|
|000048f0| 74 69 6e 67 20 6f 66 20 | 74 68 65 20 6c 69 67 68 |ting of |the ligh|
|00004900| 74 2e 20 2a 2f 0d 0d 23 | 64 65 66 69 6e 65 20 5f |t. */..#|define _|
|00004910| 5f 53 45 47 5f 5f 20 4d | 61 69 6e 0d 76 6f 69 64 |_SEG__ M|ain.void|
|00004920| 20 53 65 74 4c 69 67 68 | 74 28 20 77 69 6e 64 6f | SetLigh|t( windo|
|00004930| 77 2c 20 6e 65 77 53 74 | 6f 70 70 65 64 20 29 0d |w, newSt|opped ).|
|00004940| 09 57 69 6e 64 6f 77 50 | 74 72 09 77 69 6e 64 6f |.WindowP|tr.windo|
|00004950| 77 3b 0d 09 42 6f 6f 6c | 65 61 6e 09 09 6e 65 77 |w;..Bool|ean..new|
|00004960| 53 74 6f 70 70 65 64 3b | 0d 7b 0d 09 69 66 20 28 |Stopped;|.{..if (|
|00004970| 20 6e 65 77 53 74 6f 70 | 70 65 64 20 21 3d 20 67 | newStop|ped != g|
|00004980| 53 74 6f 70 70 65 64 20 | 29 20 7b 0d 09 09 67 53 |Stopped |) {...gS|
|00004990| 74 6f 70 70 65 64 20 3d | 20 6e 65 77 53 74 6f 70 |topped =| newStop|
|000049a0| 70 65 64 3b 0d 09 09 53 | 65 74 50 6f 72 74 28 77 |ped;...S|etPort(w|
|000049b0| 69 6e 64 6f 77 29 3b 0d | 09 09 49 6e 76 61 6c 52 |indow);.|..InvalR|
|000049c0| 65 63 74 28 26 77 69 6e | 64 6f 77 2d 3e 70 6f 72 |ect(&win|dow->por|
|000049d0| 74 52 65 63 74 29 3b 0d | 09 7d 0d 7d 20 2f 2a 53 |tRect);.|.}.} /*S|
|000049e0| 65 74 4c 69 67 68 74 2a | 2f 0d 0d 0d 2f 2a 09 43 |etLight*|/.../*.C|
|000049f0| 6c 6f 73 65 20 61 20 77 | 69 6e 64 6f 77 2e 20 54 |lose a w|indow. T|
|00004a00| 68 69 73 20 68 61 6e 64 | 6c 65 73 20 6f 6e 6c 79 |his hand|les only|
|00004a10| 20 64 65 73 6b 20 61 63 | 63 65 73 73 6f 72 79 20 | desk ac|cessory |
|00004a20| 77 69 6e 64 6f 77 73 20 | 62 65 63 61 75 73 65 20 |windows |because |
|00004a30| 77 65 20 64 6f 20 6e 6f | 74 0d 09 61 6c 6c 6f 77 |we do no|t..allow|
|00004a40| 20 6f 75 72 20 77 69 6e | 64 6f 77 20 74 6f 20 62 | our win|dow to b|
|00004a50| 65 20 63 6c 6f 73 65 64 | 2e 20 54 45 53 61 6d 70 |e closed|. TESamp|
|00004a60| 6c 65 20 70 72 6f 76 69 | 64 65 73 20 61 6e 20 65 |le provi|des an e|
|00004a70| 78 61 6d 70 6c 65 20 6f | 66 20 68 6f 77 20 74 6f |xample o|f how to|
|00004a80| 20 68 61 6e 64 6c 65 0d | 09 74 68 65 20 63 6c 6f | handle.|.the clo|
|00004a90| 73 69 6e 67 20 6f 66 20 | 61 70 70 6c 69 63 61 74 |sing of |applicat|
|00004aa0| 69 6f 6e 20 77 69 6e 64 | 6f 77 73 2e 20 2a 2f 0d |ion wind|ows. */.|
|00004ab0| 0d 23 64 65 66 69 6e 65 | 20 5f 5f 53 45 47 5f 5f |.#define| __SEG__|
|00004ac0| 20 4d 61 69 6e 0d 76 6f | 69 64 20 44 6f 43 6c 6f | Main.vo|id DoClo|
|00004ad0| 73 65 57 69 6e 64 6f 77 | 28 77 69 6e 64 6f 77 29 |seWindow|(window)|
|00004ae0| 0d 09 57 69 6e 64 6f 77 | 50 74 72 09 77 69 6e 64 |..Window|Ptr.wind|
|00004af0| 6f 77 3b 0d 7b 0d 09 69 | 66 20 28 20 49 73 44 41 |ow;.{..i|f ( IsDA|
|00004b00| 57 69 6e 64 6f 77 28 77 | 69 6e 64 6f 77 29 20 29 |Window(w|indow) )|
|00004b10| 0d 09 09 43 6c 6f 73 65 | 44 65 73 6b 41 63 63 28 |...Close|DeskAcc(|
|00004b20| 28 28 57 69 6e 64 6f 77 | 50 65 65 6b 29 20 77 69 |((Window|Peek) wi|
|00004b30| 6e 64 6f 77 29 2d 3e 77 | 69 6e 64 6f 77 4b 69 6e |ndow)->w|indowKin|
|00004b40| 64 29 3b 0d 7d 20 2f 2a | 44 6f 43 6c 6f 73 65 57 |d);.} /*|DoCloseW|
|00004b50| 69 6e 64 6f 77 2a 2f 0d | 0d 0d 2f 2a 09 43 6c 6f |indow*/.|../*.Clo|
|00004b60| 73 65 20 74 68 65 20 77 | 69 6e 64 6f 77 20 74 68 |se the w|indow th|
|00004b70| 61 74 20 69 73 20 70 61 | 73 73 65 64 20 61 6e 64 |at is pa|ssed and|
|00004b80| 20 61 6c 6c 20 77 69 6e | 64 6f 77 73 20 62 65 68 | all win|dows beh|
|00004b90| 69 6e 64 20 69 74 2e 0d | 09 54 68 69 73 20 63 6c |ind it..|.This cl|
|00004ba0| 6f 73 65 73 20 77 69 6e | 64 6f 77 73 20 66 72 6f |oses win|dows fro|
|00004bb0| 6d 20 62 61 63 6b 20 74 | 6f 20 66 72 6f 6e 74 2c |m back t|o front,|
|00004bc0| 20 62 79 20 63 61 6c 6c | 69 6e 67 20 69 74 73 65 | by call|ing itse|
|00004bd0| 6c 66 0d 09 72 65 63 75 | 72 73 69 76 65 6c 79 2c |lf..recu|rsively,|
|00004be0| 20 77 68 69 63 68 20 6d | 69 6e 69 6d 69 7a 65 73 | which m|inimizes|
|00004bf0| 20 77 69 6e 64 6f 77 20 | 75 70 64 61 74 69 6e 67 | window |updating|
|00004c00| 2e 20 41 6c 77 61 79 73 | 20 6b 65 65 70 0d 09 69 |. Always| keep..i|
|00004c10| 6e 20 6d 69 6e 64 20 74 | 68 65 20 64 61 6e 67 65 |n mind t|he dange|
|00004c20| 72 73 20 6f 66 20 73 74 | 61 63 6b 20 6f 76 65 72 |rs of st|ack over|
|00004c30| 66 6c 6f 77 20 77 68 65 | 6e 20 72 65 63 75 72 73 |flow whe|n recurs|
|00004c40| 69 76 65 20 72 6f 75 74 | 69 6e 65 73 0d 09 61 72 |ive rout|ines..ar|
|00004c50| 65 20 75 73 65 64 20 69 | 6e 20 73 69 74 75 61 74 |e used i|n situat|
|00004c60| 69 6f 6e 73 20 77 68 65 | 72 65 20 74 68 65 20 63 |ions whe|re the c|
|00004c70| 61 6c 6c 69 6e 67 20 6c | 65 76 65 6c 20 67 65 74 |alling l|evel get|
|00004c80| 73 20 74 6f 6f 0d 09 64 | 65 65 70 2e 20 54 68 61 |s too..d|eep. Tha|
|00004c90| 74 20 69 73 20 6e 6f 74 | 20 61 20 70 72 6f 62 6c |t is not| a probl|
|00004ca0| 65 6d 20 68 65 72 65 2e | 20 2a 2f 0d 0d 23 64 65 |em here.| */..#de|
|00004cb0| 66 69 6e 65 20 5f 5f 53 | 45 47 5f 5f 20 4d 61 69 |fine __S|EG__ Mai|
|00004cc0| 6e 0d 76 6f 69 64 20 44 | 6f 43 6c 6f 73 65 42 65 |n.void D|oCloseBe|
|00004cd0| 68 69 6e 64 28 77 69 6e | 64 6f 77 29 0d 09 57 69 |hind(win|dow)..Wi|
|00004ce0| 6e 64 6f 77 50 74 72 09 | 77 69 6e 64 6f 77 3b 0d |ndowPtr.|window;.|
|00004cf0| 7b 0d 09 69 66 20 28 20 | 77 69 6e 64 6f 77 20 21 |{..if ( |window !|
|00004d00| 3d 20 6e 69 6c 20 29 20 | 7b 09 2f 2a 20 69 66 20 |= nil ) |{./* if |
|00004d10| 77 65 20 61 72 65 20 70 | 61 73 73 65 64 20 61 20 |we are p|assed a |
|00004d20| 77 69 6e 64 6f 77 2c 20 | 63 6c 6f 73 65 20 6f 74 |window, |close ot|
|00004d30| 68 65 72 20 77 69 6e 64 | 6f 77 73 20 62 65 68 69 |her wind|ows behi|
|00004d40| 6e 64 20 69 74 20 66 69 | 72 73 74 20 2a 2f 0d 09 |nd it fi|rst */..|
|00004d50| 09 44 6f 43 6c 6f 73 65 | 42 65 68 69 6e 64 28 28 |.DoClose|Behind((|
|00004d60| 57 69 6e 64 6f 77 50 74 | 72 29 20 28 28 28 57 69 |WindowPt|r) (((Wi|
|00004d70| 6e 64 6f 77 50 65 65 6b | 29 20 77 69 6e 64 6f 77 |ndowPeek|) window|
|00004d80| 29 2d 3e 6e 65 78 74 57 | 69 6e 64 6f 77 29 29 3b |)->nextW|indow));|
|00004d90| 0d 09 09 44 6f 43 6c 6f | 73 65 57 69 6e 64 6f 77 |...DoClo|seWindow|
|00004da0| 28 77 69 6e 64 6f 77 29 | 3b 09 2f 2a 20 6e 6f 77 |(window)|;./* now|
|00004db0| 20 74 68 61 74 20 61 6c | 6c 20 74 68 65 20 77 69 | that al|l the wi|
|00004dc0| 6e 64 6f 77 73 20 62 65 | 68 69 6e 64 20 61 72 65 |ndows be|hind are|
|00004dd0| 20 63 6c 6f 73 65 64 2c | 20 63 6c 6f 73 65 20 74 | closed,| close t|
|00004de0| 68 69 73 20 6f 6e 65 20 | 2a 2f 0d 09 7d 0d 7d 20 |his one |*/..}.} |
|00004df0| 2f 2a 44 6f 43 6c 6f 73 | 65 42 65 68 69 6e 64 2a |/*DoClos|eBehind*|
|00004e00| 2f 0d 0d 0d 2f 2a 20 43 | 6c 65 61 6e 20 75 70 20 |/.../* C|lean up |
|00004e10| 74 68 65 20 61 70 70 6c | 69 63 61 74 69 6f 6e 20 |the appl|ication |
|00004e20| 61 6e 64 20 65 78 69 74 | 73 2e 20 57 65 20 63 6c |and exit|s. We cl|
|00004e30| 6f 73 65 20 61 6c 6c 20 | 6f 66 20 74 68 65 20 77 |ose all |of the w|
|00004e40| 69 6e 64 6f 77 73 20 73 | 6f 20 74 68 61 74 0d 20 |indows s|o that. |
|00004e50| 74 68 65 79 20 63 61 6e | 20 75 70 64 61 74 65 20 |they can| update |
|00004e60| 74 68 65 69 72 20 64 6f | 63 75 6d 65 6e 74 73 2c |their do|cuments,|
|00004e70| 20 69 66 20 61 6e 79 2e | 20 2a 2f 0d 0d 23 64 65 | if any.| */..#de|
|00004e80| 66 69 6e 65 20 5f 5f 53 | 45 47 5f 5f 20 4d 61 69 |fine __S|EG__ Mai|
|00004e90| 6e 0d 76 6f 69 64 20 54 | 65 72 6d 69 6e 61 74 65 |n.void T|erminate|
|00004ea0| 28 29 0d 7b 0d 09 44 6f | 43 6c 6f 73 65 42 65 68 |().{..Do|CloseBeh|
|00004eb0| 69 6e 64 28 46 72 6f 6e | 74 57 69 6e 64 6f 77 28 |ind(Fron|tWindow(|
|00004ec0| 29 29 3b 09 2f 2a 20 63 | 6c 6f 73 65 20 61 6c 6c |));./* c|lose all|
|00004ed0| 20 77 69 6e 64 6f 77 73 | 20 2a 2f 0d 09 45 78 69 | windows| */..Exi|
|00004ee0| 74 54 6f 53 68 65 6c 6c | 28 29 3b 0d 7d 20 2f 2a |tToShell|();.} /*|
|00004ef0| 54 65 72 6d 69 6e 61 74 | 65 2a 2f 0d 0d 0d 2f 2a |Terminat|e*/.../*|
|00004f00| 20 53 65 74 20 75 70 20 | 74 68 65 20 77 68 6f 6c | Set up |the whol|
|00004f10| 65 20 77 6f 72 6c 64 2c | 20 69 6e 63 6c 75 64 69 |e world,| includi|
|00004f20| 6e 67 20 67 6c 6f 62 61 | 6c 20 76 61 72 69 61 62 |ng globa|l variab|
|00004f30| 6c 65 73 2c 20 54 6f 6f | 6c 62 6f 78 20 6d 61 6e |les, Too|lbox man|
|00004f40| 61 67 65 72 73 2c 0d 20 | 61 6e 64 20 6d 65 6e 75 |agers,. |and menu|
|00004f50| 73 2e 20 57 65 20 61 6c | 73 6f 20 63 72 65 61 74 |s. We al|so creat|
|00004f60| 65 20 6f 75 72 20 6f 6e | 65 20 61 70 70 6c 69 63 |e our on|e applic|
|00004f70| 61 74 69 6f 6e 20 77 69 | 6e 64 6f 77 20 61 74 20 |ation wi|ndow at |
|00004f80| 74 68 69 73 20 74 69 6d | 65 2e 0d 20 53 69 6e 63 |this tim|e.. Sinc|
|00004f90| 65 20 77 69 6e 64 6f 77 | 20 73 74 6f 72 61 67 65 |e window| storage|
|00004fa0| 20 69 73 20 6e 6f 6e 2d | 72 65 6c 6f 63 61 74 65 | is non-|relocate|
|00004fb0| 61 62 6c 65 2c 20 68 6f | 77 20 61 6e 64 20 77 68 |able, ho|w and wh|
|00004fc0| 65 6e 20 74 6f 20 61 6c | 6c 6f 63 61 74 65 20 73 |en to al|locate s|
|00004fd0| 70 61 63 65 0d 20 66 6f | 72 20 77 69 6e 64 6f 77 |pace. fo|r window|
|00004fe0| 73 20 69 73 20 76 65 72 | 79 20 69 6d 70 6f 72 74 |s is ver|y import|
|00004ff0| 61 6e 74 20 73 6f 20 74 | 68 61 74 20 68 65 61 70 |ant so t|hat heap|
|00005000| 20 66 72 61 67 6d 65 6e | 74 61 74 69 6f 6e 20 64 | fragmen|tation d|
|00005010| 6f 65 73 20 6e 6f 74 20 | 6f 63 63 75 72 2e 0d 20 |oes not |occur.. |
|00005020| 42 65 63 61 75 73 65 20 | 53 61 6d 70 6c 65 20 68 |Because |Sample h|
|00005030| 61 73 20 6f 6e 6c 79 20 | 6f 6e 65 20 77 69 6e 64 |as only |one wind|
|00005040| 6f 77 20 61 6e 64 20 69 | 74 20 69 73 20 6f 6e 6c |ow and i|t is onl|
|00005050| 79 20 64 69 73 70 6f 73 | 65 64 20 77 68 65 6e 20 |y dispos|ed when |
|00005060| 74 68 65 20 61 70 70 6c | 69 63 61 74 69 6f 6e 0d |the appl|ication.|
|00005070| 20 71 75 69 74 73 2c 20 | 77 65 20 77 69 6c 6c 20 | quits, |we will |
|00005080| 61 6c 6c 6f 63 61 74 65 | 20 69 74 73 20 73 70 61 |allocate| its spa|
|00005090| 63 65 20 68 65 72 65 2c | 20 62 65 66 6f 72 65 20 |ce here,| before |
|000050a0| 61 6e 79 74 68 69 6e 67 | 20 74 68 61 74 20 6d 69 |anything| that mi|
|000050b0| 67 68 74 20 62 65 20 61 | 20 6c 6f 63 6b 65 64 0d |ght be a| locked.|
|000050c0| 20 72 65 6c 6f 63 61 74 | 61 62 6c 65 20 6f 62 6a | relocat|able obj|
|000050d0| 65 63 74 20 67 65 74 73 | 20 69 6e 74 6f 20 74 68 |ect gets| into th|
|000050e0| 65 20 68 65 61 70 2e 20 | 54 68 69 73 20 77 61 79 |e heap. |This way|
|000050f0| 2c 20 77 65 20 63 61 6e | 20 66 6f 72 63 65 20 74 |, we can| force t|
|00005100| 68 65 20 73 74 6f 72 61 | 67 65 20 74 6f 20 62 65 |he stora|ge to be|
|00005110| 0d 20 69 6e 20 74 68 65 | 20 6c 6f 77 65 73 74 20 |. in the| lowest |
|00005120| 6d 65 6d 6f 72 79 20 61 | 76 61 69 6c 61 62 6c 65 |memory a|vailable|
|00005130| 20 69 6e 20 74 68 65 20 | 68 65 61 70 2e 20 57 69 | in the |heap. Wi|
|00005140| 6e 64 6f 77 20 73 74 6f | 72 61 67 65 20 63 61 6e |ndow sto|rage can|
|00005150| 20 64 69 66 66 65 72 20 | 77 69 64 65 6c 79 0d 20 | differ |widely. |
|00005160| 61 6d 6f 6e 67 73 74 20 | 61 70 70 6c 69 63 61 74 |amongst |applicat|
|00005170| 69 6f 6e 73 20 64 65 70 | 65 6e 64 69 6e 67 20 6f |ions dep|ending o|
|00005180| 6e 20 68 6f 77 20 6d 61 | 6e 79 20 77 69 6e 64 6f |n how ma|ny windo|
|00005190| 77 73 20 61 72 65 20 63 | 72 65 61 74 65 64 20 61 |ws are c|reated a|
|000051a0| 6e 64 20 64 69 73 70 6f | 73 65 64 2e 0d 20 49 66 |nd dispo|sed.. If|
|000051b0| 20 61 20 66 61 69 6c 75 | 72 65 20 6f 63 63 75 72 | a failu|re occur|
|000051c0| 73 20 68 65 72 65 2c 20 | 77 65 20 77 69 6c 6c 20 |s here, |we will |
|000051d0| 61 73 73 75 6d 65 20 74 | 68 61 74 20 74 68 65 20 |assume t|hat the |
|000051e0| 61 70 70 6c 69 63 61 74 | 69 6f 6e 20 69 73 20 69 |applicat|ion is i|
|000051f0| 6e 20 73 75 63 68 0d 20 | 62 61 64 20 73 68 61 70 |n such. |bad shap|
|00005200| 65 20 74 68 61 74 20 77 | 65 20 73 68 6f 75 6c 64 |e that w|e should|
|00005210| 20 6a 75 73 74 20 65 78 | 69 74 2e 20 59 6f 75 72 | just ex|it. Your|
|00005220| 20 65 72 72 6f 72 20 68 | 61 6e 64 6c 69 6e 67 20 | error h|andling |
|00005230| 6d 61 79 20 64 69 66 66 | 65 72 2c 20 62 75 74 0d |may diff|er, but.|
|00005240| 20 74 68 65 20 63 68 65 | 63 6b 73 20 73 68 6f 75 | the che|cks shou|
|00005250| 6c 64 20 73 74 69 6c 6c | 20 62 65 20 6d 61 64 65 |ld still| be made|
|00005260| 2e 20 2a 2f 0d 0d 23 64 | 65 66 69 6e 65 20 5f 5f |. */..#d|efine __|
|00005270| 53 45 47 5f 5f 20 49 6e | 69 74 69 61 6c 69 7a 65 |SEG__ In|itialize|
|00005280| 0d 76 6f 69 64 20 49 6e | 69 74 69 61 6c 69 7a 65 |.void In|itialize|
|00005290| 28 29 0d 7b 0d 09 48 61 | 6e 64 6c 65 09 09 6d 65 |().{..Ha|ndle..me|
|000052a0| 6e 75 42 61 72 3b 0d 09 | 57 69 6e 64 6f 77 50 74 |nuBar;..|WindowPt|
|000052b0| 72 09 77 69 6e 64 6f 77 | 3b 0d 0d 09 67 48 61 73 |r.window|;...gHas|
|000052c0| 57 61 69 74 4e 65 78 74 | 45 76 65 6e 74 20 3d 20 |WaitNext|Event = |
|000052d0| 54 72 61 70 41 76 61 69 | 6c 61 62 6c 65 28 5f 57 |TrapAvai|lable(_W|
|000052e0| 61 69 74 4e 65 78 74 45 | 76 65 6e 74 2c 20 54 6f |aitNextE|vent, To|
|000052f0| 6f 6c 54 72 61 70 29 3b | 0d 09 67 49 6e 42 61 63 |olTrap);|..gInBac|
|00005300| 6b 67 72 6f 75 6e 64 20 | 3d 20 66 61 6c 73 65 3b |kground |= false;|
|00005310| 0d 0d 09 49 6e 69 74 47 | 72 61 66 28 28 50 74 72 |...InitG|raf((Ptr|
|00005320| 29 20 26 71 64 2e 74 68 | 65 50 6f 72 74 29 3b 0d |) &qd.th|ePort);.|
|00005330| 09 49 6e 69 74 46 6f 6e | 74 73 28 29 3b 0d 09 49 |.InitFon|ts();..I|
|00005340| 6e 69 74 57 69 6e 64 6f | 77 73 28 29 3b 0d 09 49 |nitWindo|ws();..I|
|00005350| 6e 69 74 4d 65 6e 75 73 | 28 29 3b 0d 09 54 45 49 |nitMenus|();..TEI|
|00005360| 6e 69 74 28 29 3b 0d 09 | 49 6e 69 74 44 69 61 6c |nit();..|InitDial|
|00005370| 6f 67 73 28 6e 69 6c 29 | 3b 0d 09 49 6e 69 74 43 |ogs(nil)|;..InitC|
|00005380| 75 72 73 6f 72 28 29 3b | 0d 09 0d 2f 2a 20 09 77 |ursor();|.../* .w|
|00005390| 65 20 77 69 6c 6c 20 61 | 6c 6c 6f 63 61 74 65 20 |e will a|llocate |
|000053a0| 6f 75 72 20 6f 77 6e 20 | 77 69 6e 64 6f 77 20 73 |our own |window s|
|000053b0| 74 6f 72 61 67 65 20 69 | 6e 73 74 65 61 64 20 6f |torage i|nstead o|
|000053c0| 66 20 6c 65 74 74 69 6e | 67 20 74 68 65 20 57 69 |f lettin|g the Wi|
|000053d0| 6e 64 6f 77 0d 09 4d 61 | 6e 61 67 65 72 20 64 6f |ndow..Ma|nager do|
|000053e0| 20 69 74 20 62 65 63 61 | 75 73 65 20 47 65 74 4e | it beca|use GetN|
|000053f0| 65 77 57 69 6e 64 6f 77 | 20 6d 61 79 20 6c 6f 61 |ewWindow| may loa|
|00005400| 64 20 69 6e 20 74 65 6d | 70 2e 20 72 65 73 6f 75 |d in tem|p. resou|
|00005410| 72 63 65 73 20 62 65 66 | 6f 72 65 0d 09 6d 61 6b |rces bef|ore..mak|
|00005420| 69 6e 67 20 74 68 65 20 | 4e 65 77 50 74 72 20 63 |ing the |NewPtr c|
|00005430| 61 6c 6c 2c 20 61 6e 64 | 20 74 68 69 73 20 63 61 |all, and| this ca|
|00005440| 6e 20 6c 65 61 64 20 74 | 6f 20 68 65 61 70 20 66 |n lead t|o heap f|
|00005450| 72 61 67 6d 65 6e 74 61 | 74 69 6f 6e 2e 20 2a 2f |ragmenta|tion. */|
|00005460| 0d 09 77 69 6e 64 6f 77 | 20 3d 20 28 57 69 6e 64 |..window| = (Wind|
|00005470| 6f 77 50 74 72 29 20 4e | 65 77 50 74 72 28 73 69 |owPtr) N|ewPtr(si|
|00005480| 7a 65 6f 66 28 57 69 6e | 64 6f 77 52 65 63 6f 72 |zeof(Win|dowRecor|
|00005490| 64 29 29 3b 0d 09 69 66 | 20 28 20 77 69 6e 64 6f |d));..if| ( windo|
|000054a0| 77 20 3d 3d 20 6e 69 6c | 20 29 20 45 78 69 74 54 |w == nil| ) ExitT|
|000054b0| 6f 53 68 65 6c 6c 28 29 | 3b 0d 09 77 69 6e 64 6f |oShell()|;..windo|
|000054c0| 77 20 3d 20 47 65 74 4e | 65 77 57 69 6e 64 6f 77 |w = GetN|ewWindow|
|000054d0| 28 72 57 69 6e 64 6f 77 | 2c 20 28 50 74 72 29 20 |(rWindow|, (Ptr) |
|000054e0| 77 69 6e 64 6f 77 2c 20 | 28 57 69 6e 64 6f 77 50 |window, |(WindowP|
|000054f0| 74 72 29 20 2d 31 29 3b | 0d 0d 09 6d 65 6e 75 42 |tr) -1);|...menuB|
|00005500| 61 72 20 3d 20 47 65 74 | 4e 65 77 4d 42 61 72 28 |ar = Get|NewMBar(|
|00005510| 72 4d 65 6e 75 42 61 72 | 29 3b 09 09 09 2f 2a 20 |rMenuBar|);.../* |
|00005520| 72 65 61 64 20 6d 65 6e | 75 73 20 69 6e 74 6f 20 |read men|us into |
|00005530| 6d 65 6e 75 20 62 61 72 | 20 2a 2f 0d 09 69 66 20 |menu bar| */..if |
|00005540| 28 20 6d 65 6e 75 42 61 | 72 20 3d 3d 20 6e 69 6c |( menuBa|r == nil|
|00005550| 20 29 20 45 78 69 74 54 | 6f 53 68 65 6c 6c 28 29 | ) ExitT|oShell()|
|00005560| 3b 0d 09 53 65 74 4d 65 | 6e 75 42 61 72 28 6d 65 |;..SetMe|nuBar(me|
|00005570| 6e 75 42 61 72 29 3b 09 | 09 09 09 09 2f 2a 20 69 |nuBar);.|..../* i|
|00005580| 6e 73 74 61 6c 6c 20 6d | 65 6e 75 73 20 2a 2f 0d |nstall m|enus */.|
|00005590| 09 44 69 73 70 6f 73 48 | 61 6e 64 6c 65 28 6d 65 |.DisposH|andle(me|
|000055a0| 6e 75 42 61 72 29 3b 0d | 09 41 64 64 52 65 73 4d |nuBar);.|.AddResM|
|000055b0| 65 6e 75 28 47 65 74 4d | 48 61 6e 64 6c 65 28 6d |enu(GetM|Handle(m|
|000055c0| 41 70 70 6c 65 29 2c 20 | 27 44 52 56 52 27 29 3b |Apple), |'DRVR');|
|000055d0| 09 2f 2a 20 61 64 64 20 | 44 41 20 6e 61 6d 65 73 |./* add |DA names|
|000055e0| 20 74 6f 20 41 70 70 6c | 65 20 6d 65 6e 75 20 2a | to Appl|e menu *|
|000055f0| 2f 0d 09 44 72 61 77 4d | 65 6e 75 42 61 72 28 29 |/..DrawM|enuBar()|
|00005600| 3b 0d 09 0d 09 67 53 74 | 6f 70 70 65 64 20 3d 20 |;....gSt|opped = |
|00005610| 74 72 75 65 3b 0d 09 47 | 6f 47 65 74 52 65 63 74 |true;..G|oGetRect|
|00005620| 28 72 53 74 6f 70 52 65 | 63 74 2c 20 26 67 53 74 |(rStopRe|ct, &gSt|
|00005630| 6f 70 52 65 63 74 29 3b | 09 09 2f 2a 20 74 68 65 |opRect);|../* the|
|00005640| 20 73 74 6f 70 20 6c 69 | 67 68 74 20 72 65 63 74 | stop li|ght rect|
|00005650| 61 6e 67 6c 65 20 2a 2f | 0d 09 47 6f 47 65 74 52 |angle */|..GoGetR|
|00005660| 65 63 74 28 72 47 6f 52 | 65 63 74 2c 20 26 67 47 |ect(rGoR|ect, &gG|
|00005670| 6f 52 65 63 74 29 3b 09 | 09 09 2f 2a 20 74 68 65 |oRect);.|../* the|
|00005680| 20 67 6f 20 6c 69 67 68 | 74 20 72 65 63 74 61 6e | go ligh|t rectan|
|00005690| 67 6c 65 20 2a 2f 0d 7d | 20 2f 2a 49 6e 69 74 69 |gle */.}| /*Initi|
|000056a0| 61 6c 69 7a 65 2a 2f 0d | 0d 0d 2f 2a 09 54 68 69 |alize*/.|../*.Thi|
|000056b0| 73 20 75 74 69 6c 69 74 | 79 20 6c 6f 61 64 73 20 |s utilit|y loads |
|000056c0| 74 68 65 20 67 6c 6f 62 | 61 6c 20 72 65 63 74 61 |the glob|al recta|
|000056d0| 6e 67 6c 65 73 20 74 68 | 61 74 20 61 72 65 20 75 |ngles th|at are u|
|000056e0| 73 65 64 20 62 79 20 74 | 68 65 20 77 69 6e 64 6f |sed by t|he windo|
|000056f0| 77 0d 09 64 72 61 77 69 | 6e 67 20 72 6f 75 74 69 |w..drawi|ng routi|
|00005700| 6e 65 73 2e 20 49 74 20 | 73 68 6f 77 73 20 68 6f |nes. It |shows ho|
|00005710| 77 20 74 68 65 20 72 65 | 73 6f 75 72 63 65 20 6d |w the re|source m|
|00005720| 61 6e 61 67 65 72 20 63 | 61 6e 20 62 65 20 75 73 |anager c|an be us|
|00005730| 65 64 20 74 6f 20 68 6f | 6c 64 0d 09 76 61 6c 75 |ed to ho|ld..valu|
|00005740| 65 73 20 69 6e 20 61 20 | 63 6f 6e 76 65 6e 69 65 |es in a |convenie|
|00005750| 6e 74 20 6d 61 6e 6e 65 | 72 2e 20 54 68 65 73 65 |nt manne|r. These|
|00005760| 20 76 61 6c 75 65 73 20 | 61 72 65 20 74 68 65 6e | values |are then|
|00005770| 20 65 61 73 69 6c 79 20 | 61 6c 74 65 72 65 64 20 | easily |altered |
|00005780| 77 69 74 68 6f 75 74 0d | 09 68 61 76 69 6e 67 20 |without.|.having |
|00005790| 74 6f 20 72 65 2d 63 6f | 6d 70 69 6c 65 20 74 68 |to re-co|mpile th|
|000057a0| 65 20 73 6f 75 72 63 65 | 20 63 6f 64 65 2e 20 49 |e source| code. I|
|000057b0| 6e 20 74 68 69 73 20 70 | 61 72 74 69 63 75 6c 61 |n this p|articula|
|000057c0| 72 20 63 61 73 65 2c 20 | 77 65 20 6b 6e 6f 77 0d |r case, |we know.|
|000057d0| 09 74 68 61 74 20 74 68 | 69 73 20 72 6f 75 74 69 |.that th|is routi|
|000057e0| 6e 65 20 69 73 20 62 65 | 69 6e 67 20 63 61 6c 6c |ne is be|ing call|
|000057f0| 65 64 20 61 74 20 69 6e | 69 74 69 61 6c 69 7a 61 |ed at in|itializa|
|00005800| 74 69 6f 6e 20 74 69 6d | 65 2e 20 54 68 65 72 65 |tion tim|e. There|
|00005810| 66 6f 72 65 2c 0d 09 69 | 66 20 61 20 66 61 69 6c |fore,..i|f a fail|
|00005820| 75 72 65 20 6f 63 63 75 | 72 73 20 68 65 72 65 2c |ure occu|rs here,|
|00005830| 20 77 65 20 77 69 6c 6c | 20 61 73 73 75 6d 65 20 | we will| assume |
|00005840| 74 68 61 74 20 74 68 65 | 20 61 70 70 6c 69 63 61 |that the| applica|
|00005850| 74 69 6f 6e 20 69 73 20 | 69 6e 20 73 75 63 68 0d |tion is |in such.|
|00005860| 09 62 61 64 20 73 68 61 | 70 65 20 74 68 61 74 20 |.bad sha|pe that |
|00005870| 77 65 20 73 68 6f 75 6c | 64 20 6a 75 73 74 20 65 |we shoul|d just e|
|00005880| 78 69 74 2e 20 59 6f 75 | 72 20 65 72 72 6f 72 20 |xit. You|r error |
|00005890| 68 61 6e 64 6c 69 6e 67 | 20 6d 61 79 20 64 69 66 |handling| may dif|
|000058a0| 66 65 72 2c 20 62 75 74 | 0d 09 74 68 65 20 63 68 |fer, but|..the ch|
|000058b0| 65 63 6b 20 73 68 6f 75 | 6c 64 20 73 74 69 6c 6c |eck shou|ld still|
|000058c0| 20 62 65 20 6d 61 64 65 | 2e 20 2a 2f 0d 09 0d 23 | be made|. */...#|
|000058d0| 64 65 66 69 6e 65 20 5f | 5f 53 45 47 5f 5f 20 49 |define _|_SEG__ I|
|000058e0| 6e 69 74 69 61 6c 69 7a | 65 0d 76 6f 69 64 20 47 |nitializ|e.void G|
|000058f0| 6f 47 65 74 52 65 63 74 | 28 20 73 68 6f 72 74 20 |oGetRect|( short |
|00005900| 72 65 63 74 49 44 2c 20 | 52 65 63 74 20 2a 74 68 |rectID, |Rect *th|
|00005910| 65 52 65 63 74 20 29 0d | 7b 0d 09 48 61 6e 64 6c |eRect ).|{..Handl|
|00005920| 65 09 09 72 65 73 6f 75 | 72 63 65 3b 0d 09 0d 09 |e..resou|rce;....|
|00005930| 72 65 73 6f 75 72 63 65 | 20 3d 20 47 65 74 52 65 |resource| = GetRe|
|00005940| 73 6f 75 72 63 65 28 27 | 52 45 43 54 27 2c 20 72 |source('|RECT', r|
|00005950| 65 63 74 49 44 29 3b 0d | 09 69 66 20 28 20 72 65 |ectID);.|.if ( re|
|00005960| 73 6f 75 72 63 65 20 3d | 3d 20 6e 69 6c 20 29 20 |source =|= nil ) |
|00005970| 45 78 69 74 54 6f 53 68 | 65 6c 6c 28 29 3b 0d 09 |ExitToSh|ell();..|
|00005980| 2a 74 68 65 52 65 63 74 | 20 3d 20 2a 2a 28 28 52 |*theRect| = **((R|
|00005990| 65 63 74 2a 2a 29 20 72 | 65 73 6f 75 72 63 65 29 |ect**) r|esource)|
|000059a0| 3b 0d 7d 20 2f 2a 20 47 | 6f 47 65 74 52 65 63 74 |;.} /* G|oGetRect|
|000059b0| 20 2a 2f 0d 0d 0d 2f 2a | 09 4d 61 6b 65 20 73 75 | */.../*|.Make su|
|000059c0| 72 65 20 74 68 61 74 20 | 74 68 65 20 6d 61 63 68 |re that |the mach|
|000059d0| 69 6e 65 20 68 61 73 20 | 61 74 20 6c 65 61 73 74 |ine has |at least|
|000059e0| 20 31 32 38 4b 20 52 4f | 4d 73 20 61 6e 64 20 65 | 128K RO|Ms and e|
|000059f0| 6e 6f 75 67 68 20 6d 65 | 6d 6f 72 79 20 74 6f 20 |nough me|mory to |
|00005a00| 72 75 6e 2e 0d 09 49 66 | 20 69 74 20 64 6f 65 73 |run...If| it does|
|00005a10| 6e 27 74 2c 20 65 78 69 | 74 2e 20 53 79 73 45 6e |n't, exi|t. SysEn|
|00005a20| 76 69 72 6f 6e 73 20 63 | 61 6e 20 62 65 20 63 61 |virons c|an be ca|
|00005a30| 6c 6c 65 64 20 62 65 66 | 6f 72 65 20 74 68 65 20 |lled bef|ore the |
|00005a40| 74 6f 6f 6c 62 6f 78 20 | 6d 61 6e 61 67 65 72 73 |toolbox |managers|
|00005a50| 0d 09 61 72 65 20 69 6e | 69 74 69 61 6c 69 7a 65 |..are in|itialize|
|00005a60| 64 2c 20 61 6e 64 20 77 | 65 20 6e 65 65 64 20 74 |d, and w|e need t|
|00005a70| 6f 20 63 61 6c 6c 20 69 | 74 20 61 74 20 74 68 69 |o call i|t at thi|
|00005a80| 73 20 70 6f 69 6e 74 20 | 73 6f 20 77 65 20 63 61 |s point |so we ca|
|00005a90| 6e 20 63 68 65 63 6b 20 | 66 6f 72 0d 09 74 68 65 |n check |for..the|
|00005aa0| 20 72 69 67 68 74 20 52 | 4f 4d 73 20 61 6e 64 20 | right R|OMs and |
|00005ab0| 6d 65 6d 6f 72 79 20 61 | 76 61 69 6c 61 62 69 6c |memory a|vailabil|
|00005ac0| 69 74 79 20 62 65 66 6f | 72 65 20 77 65 20 63 61 |ity befo|re we ca|
|00005ad0| 6c 6c 20 4d 61 78 41 70 | 70 6c 5a 6f 6e 65 20 61 |ll MaxAp|plZone a|
|00005ae0| 6e 64 0d 09 69 6e 69 74 | 69 61 6c 69 7a 65 20 74 |nd..init|ialize t|
|00005af0| 68 65 20 74 6f 6f 6c 62 | 6f 78 20 6d 61 6e 61 67 |he toolb|ox manag|
|00005b00| 65 72 73 2e 20 49 66 20 | 41 70 70 6c 65 54 61 6c |ers. If |AppleTal|
|00005b10| 6b 20 68 61 73 20 6e 6f | 74 20 62 65 65 6e 20 69 |k has no|t been i|
|00005b20| 6e 69 74 69 61 6c 69 7a | 65 64 2c 20 79 6f 75 0d |nitializ|ed, you.|
|00005b30| 09 77 6f 6e 27 74 20 67 | 65 74 20 74 68 65 20 76 |.won't g|et the v|
|00005b40| 65 72 73 69 6f 6e 20 6f | 66 20 74 68 65 20 41 70 |ersion o|f the Ap|
|00005b50| 70 6c 65 54 61 6c 6b 20 | 64 72 69 76 65 72 20 74 |pleTalk |driver t|
|00005b60| 68 61 74 20 69 73 20 72 | 75 6e 6e 69 6e 67 2e 20 |hat is r|unning. |
|00005b70| 54 68 61 74 20 69 73 20 | 6e 6f 74 0d 09 63 72 69 |That is |not..cri|
|00005b80| 74 69 63 61 6c 20 68 65 | 72 65 2c 20 61 6e 64 20 |tical he|re, and |
|00005b90| 69 66 20 74 68 61 74 20 | 69 6e 66 6f 72 6d 61 74 |if that |informat|
|00005ba0| 69 6f 6e 20 77 61 73 20 | 72 65 71 75 69 72 65 64 |ion was |required|
|00005bb0| 2c 20 53 79 73 45 6e 76 | 69 72 6f 6e 73 20 63 6f |, SysEnv|irons co|
|00005bc0| 75 6c 64 20 62 65 0d 09 | 63 61 6c 6c 65 64 20 61 |uld be..|called a|
|00005bd0| 67 61 69 6e 20 61 66 74 | 65 72 20 41 70 70 6c 65 |gain aft|er Apple|
|00005be0| 54 61 6c 6b 20 68 61 64 | 20 62 65 65 6e 20 69 6e |Talk had| been in|
|00005bf0| 69 74 69 61 6c 69 7a 65 | 64 2e 20 2a 2f 0d 0d 23 |itialize|d. */..#|
|00005c00| 64 65 66 69 6e 65 20 5f | 5f 53 45 47 5f 5f 20 4d |define _|_SEG__ M|
|00005c10| 61 69 6e 0d 76 6f 69 64 | 20 46 6f 72 63 65 45 6e |ain.void| ForceEn|
|00005c20| 76 69 72 6f 6e 73 28 29 | 0d 7b 0d 09 4f 53 45 72 |virons()|.{..OSEr|
|00005c30| 72 09 69 67 6e 6f 72 65 | 45 72 72 6f 72 3b 0d 0d |r.ignore|Error;..|
|00005c40| 09 2f 2a 20 69 67 6e 6f | 72 65 20 74 68 65 20 65 |./* igno|re the e|
|00005c50| 72 72 6f 72 20 72 65 74 | 75 72 6e 65 64 20 66 72 |rror ret|urned fr|
|00005c60| 6f 6d 20 53 79 73 45 6e | 76 69 72 6f 6e 73 3b 20 |om SysEn|virons; |
|00005c70| 65 76 65 6e 20 69 66 20 | 61 6e 20 65 72 72 6f 72 |even if |an error|
|00005c80| 20 6f 63 63 75 72 72 65 | 64 2c 0d 09 20 20 20 74 | occurre|d,.. t|
|00005c90| 68 65 20 53 79 73 45 6e | 76 69 72 6f 6e 73 20 67 |he SysEn|virons g|
|00005ca0| 6c 75 65 20 77 69 6c 6c | 20 66 69 6c 6c 20 69 6e |lue will| fill in|
|00005cb0| 20 74 68 65 20 53 79 73 | 45 6e 76 52 65 63 20 2a | the Sys|EnvRec *|
|00005cc0| 2f 0d 09 69 67 6e 6f 72 | 65 45 72 72 6f 72 20 3d |/..ignor|eError =|
|00005cd0| 20 53 79 73 45 6e 76 69 | 72 6f 6e 73 28 73 79 73 | SysEnvi|rons(sys|
|00005ce0| 45 6e 76 69 72 6f 6e 73 | 56 65 72 73 69 6f 6e 2c |Environs|Version,|
|00005cf0| 20 26 67 4d 61 63 29 3b | 0d 09 69 66 20 28 20 28 | &gMac);|..if ( (|
|00005d00| 67 4d 61 63 2e 6d 61 63 | 68 69 6e 65 54 79 70 65 |gMac.mac|hineType|
|00005d10| 20 3c 20 30 29 20 7c 7c | 0d 09 09 28 53 74 61 63 | < 0) |||...(Stac|
|00005d20| 6b 53 70 61 63 65 28 29 | 20 2b 20 28 6c 6f 6e 67 |kSpace()| + (long|
|00005d30| 29 20 47 65 74 41 70 70 | 6c 4c 69 6d 69 74 28 29 |) GetApp|lLimit()|
|00005d40| 20 2d 20 28 6c 6f 6e 67 | 29 20 41 70 70 6c 69 63 | - (long|) Applic|
|00005d50| 5a 6f 6e 65 28 29 20 3c | 20 6b 4d 69 6e 53 69 7a |Zone() <| kMinSiz|
|00005d60| 65 20 2a 20 31 30 32 34 | 29 20 29 0d 09 09 45 78 |e * 1024|) )...Ex|
|00005d70| 69 74 54 6f 53 68 65 6c | 6c 28 29 3b 0d 09 2f 2a |itToShel|l();../*|
|00005d80| 20 69 66 20 79 6f 75 20 | 68 61 76 65 20 73 74 61 | if you |have sta|
|00005d90| 63 6b 20 72 65 71 75 69 | 72 65 6d 65 6e 74 73 20 |ck requi|rements |
|00005da0| 74 68 61 74 20 64 69 66 | 66 65 72 20 66 72 6f 6d |that dif|fer from|
|00005db0| 20 74 68 65 20 64 65 66 | 61 75 6c 74 2c 0d 09 20 | the def|ault,.. |
|00005dc0| 20 20 74 68 65 6e 20 79 | 6f 75 20 63 6f 75 6c 64 | then y|ou could|
|00005dd0| 20 75 73 65 20 53 65 74 | 41 70 70 6c 4c 69 6d 69 | use Set|ApplLimi|
|00005de0| 74 20 74 6f 20 69 6e 63 | 72 65 61 73 65 20 53 74 |t to inc|rease St|
|00005df0| 61 63 6b 53 70 61 63 65 | 20 61 74 20 74 68 69 73 |ackSpace| at this|
|00005e00| 20 70 6f 69 6e 74 2e 20 | 2a 2f 0d 7d 20 2f 2a 20 | point. |*/.} /* |
|00005e10| 46 6f 72 63 65 45 6e 76 | 69 72 6f 6e 73 20 2a 2f |ForceEnv|irons */|
|00005e20| 0d 0d 0d 2f 2a 09 43 68 | 65 63 6b 20 74 6f 20 73 |.../*.Ch|eck to s|
|00005e30| 65 65 20 69 66 20 61 20 | 77 69 6e 64 6f 77 20 62 |ee if a |window b|
|00005e40| 65 6c 6f 6e 67 73 20 74 | 6f 20 74 68 65 20 61 70 |elongs t|o the ap|
|00005e50| 70 6c 69 63 61 74 69 6f | 6e 2e 20 49 66 20 74 68 |plicatio|n. If th|
|00005e60| 65 20 77 69 6e 64 6f 77 | 20 70 6f 69 6e 74 65 72 |e window| pointer|
|00005e70| 0d 09 70 61 73 73 65 64 | 20 77 61 73 20 4e 49 4c |..passed| was NIL|
|00005e80| 2c 20 74 68 65 6e 20 69 | 74 20 63 6f 75 6c 64 20 |, then i|t could |
|00005e90| 6e 6f 74 20 62 65 20 61 | 6e 20 61 70 70 6c 69 63 |not be a|n applic|
|00005ea0| 61 74 69 6f 6e 20 77 69 | 6e 64 6f 77 2e 20 57 69 |ation wi|ndow. Wi|
|00005eb0| 6e 64 6f 77 4b 69 6e 64 | 73 0d 09 74 68 61 74 20 |ndowKind|s..that |
|00005ec0| 61 72 65 20 6e 65 67 61 | 74 69 76 65 20 62 65 6c |are nega|tive bel|
|00005ed0| 6f 6e 67 20 74 6f 20 74 | 68 65 20 73 79 73 74 65 |ong to t|he syste|
|00005ee0| 6d 20 61 6e 64 20 77 69 | 6e 64 6f 77 4b 69 6e 64 |m and wi|ndowKind|
|00005ef0| 73 20 6c 65 73 73 20 74 | 68 61 6e 20 75 73 65 72 |s less t|han user|
|00005f00| 4b 69 6e 64 0d 09 61 72 | 65 20 72 65 73 65 72 76 |Kind..ar|e reserv|
|00005f10| 65 64 20 62 79 20 41 70 | 70 6c 65 20 65 78 63 65 |ed by Ap|ple exce|
|00005f20| 70 74 20 66 6f 72 20 77 | 69 6e 64 6f 77 4b 69 6e |pt for w|indowKin|
|00005f30| 64 73 20 65 71 75 61 6c | 20 74 6f 20 64 69 61 6c |ds equal| to dial|
|00005f40| 6f 67 4b 69 6e 64 2c 20 | 77 68 69 63 68 0d 09 6d |ogKind, |which..m|
|00005f50| 65 61 6e 20 69 74 20 69 | 73 20 61 20 64 69 61 6c |ean it i|s a dial|
|00005f60| 6f 67 2e 20 2a 2f 0d 0d | 23 64 65 66 69 6e 65 20 |og. */..|#define |
|00005f70| 5f 5f 53 45 47 5f 5f 20 | 4d 61 69 6e 0d 42 6f 6f |__SEG__ |Main.Boo|
|00005f80| 6c 65 61 6e 20 49 73 41 | 70 70 57 69 6e 64 6f 77 |lean IsA|ppWindow|
|00005f90| 28 77 69 6e 64 6f 77 29 | 0d 09 57 69 6e 64 6f 77 |(window)|..Window|
|00005fa0| 50 74 72 09 77 69 6e 64 | 6f 77 3b 0d 7b 0d 09 73 |Ptr.wind|ow;.{..s|
|00005fb0| 68 6f 72 74 09 09 77 69 | 6e 64 6f 77 4b 69 6e 64 |hort..wi|ndowKind|
|00005fc0| 3b 0d 0d 09 69 66 20 28 | 20 77 69 6e 64 6f 77 20 |;...if (| window |
|00005fd0| 3d 3d 20 6e 69 6c 20 29 | 0d 09 09 72 65 74 75 72 |== nil )|...retur|
|00005fe0| 6e 20 66 61 6c 73 65 3b | 0d 09 65 6c 73 65 20 7b |n false;|..else {|
|00005ff0| 09 2f 2a 20 61 70 70 6c | 69 63 61 74 69 6f 6e 20 |./* appl|ication |
|00006000| 77 69 6e 64 6f 77 73 20 | 68 61 76 65 20 77 69 6e |windows |have win|
|00006010| 64 6f 77 4b 69 6e 64 73 | 20 3e 3d 20 75 73 65 72 |dowKinds| >= user|
|00006020| 4b 69 6e 64 20 28 38 29 | 20 6f 72 20 64 69 61 6c |Kind (8)| or dial|
|00006030| 6f 67 4b 69 6e 64 20 28 | 32 29 20 2a 2f 0d 09 09 |ogKind (|2) */...|
|00006040| 77 69 6e 64 6f 77 4b 69 | 6e 64 20 3d 20 28 28 57 |windowKi|nd = ((W|
|00006050| 69 6e 64 6f 77 50 65 65 | 6b 29 20 77 69 6e 64 6f |indowPee|k) windo|
|00006060| 77 29 2d 3e 77 69 6e 64 | 6f 77 4b 69 6e 64 3b 0d |w)->wind|owKind;.|
|00006070| 09 09 72 65 74 75 72 6e | 20 28 77 69 6e 64 6f 77 |..return| (window|
|00006080| 4b 69 6e 64 20 3e 3d 20 | 75 73 65 72 4b 69 6e 64 |Kind >= |userKind|
|00006090| 29 20 7c 7c 20 28 77 69 | 6e 64 6f 77 4b 69 6e 64 |) || (wi|ndowKind|
|000060a0| 20 3d 3d 20 64 69 61 6c | 6f 67 4b 69 6e 64 29 3b | == dial|ogKind);|
|000060b0| 0d 09 7d 0d 7d 20 2f 2a | 49 73 41 70 70 57 69 6e |..}.} /*|IsAppWin|
|000060c0| 64 6f 77 2a 2f 0d 0d 0d | 2f 2a 20 43 68 65 63 6b |dow*/...|/* Check|
|000060d0| 20 74 6f 20 73 65 65 20 | 69 66 20 61 20 77 69 6e | to see |if a win|
|000060e0| 64 6f 77 20 62 65 6c 6f | 6e 67 73 20 74 6f 20 61 |dow belo|ngs to a|
|000060f0| 20 64 65 73 6b 20 61 63 | 63 65 73 73 6f 72 79 2e | desk ac|cessory.|
|00006100| 20 2a 2f 0d 0d 23 64 65 | 66 69 6e 65 20 5f 5f 53 | */..#de|fine __S|
|00006110| 45 47 5f 5f 20 4d 61 69 | 6e 0d 42 6f 6f 6c 65 61 |EG__ Mai|n.Boolea|
|00006120| 6e 20 49 73 44 41 57 69 | 6e 64 6f 77 28 77 69 6e |n IsDAWi|ndow(win|
|00006130| 64 6f 77 29 0d 09 57 69 | 6e 64 6f 77 50 74 72 09 |dow)..Wi|ndowPtr.|
|00006140| 77 69 6e 64 6f 77 3b 0d | 7b 0d 09 69 66 20 28 20 |window;.|{..if ( |
|00006150| 77 69 6e 64 6f 77 20 3d | 3d 20 6e 69 6c 20 29 0d |window =|= nil ).|
|00006160| 09 09 72 65 74 75 72 6e | 20 66 61 6c 73 65 3b 0d |..return| false;.|
|00006170| 09 65 6c 73 65 09 2f 2a | 20 44 41 20 77 69 6e 64 |.else./*| DA wind|
|00006180| 6f 77 73 20 68 61 76 65 | 20 6e 65 67 61 74 69 76 |ows have| negativ|
|00006190| 65 20 77 69 6e 64 6f 77 | 4b 69 6e 64 73 20 2a 2f |e window|Kinds */|
|000061a0| 0d 09 09 72 65 74 75 72 | 6e 20 28 28 57 69 6e 64 |...retur|n ((Wind|
|000061b0| 6f 77 50 65 65 6b 29 20 | 77 69 6e 64 6f 77 29 2d |owPeek) |window)-|
|000061c0| 3e 77 69 6e 64 6f 77 4b | 69 6e 64 20 3c 20 30 3b |>windowK|ind < 0;|
|000061d0| 0d 7d 20 2f 2a 49 73 44 | 41 57 69 6e 64 6f 77 2a |.} /*IsD|AWindow*|
|000061e0| 2f 0d 0d 0d 2f 2a 09 43 | 68 65 63 6b 20 74 6f 20 |/.../*.C|heck to |
|000061f0| 73 65 65 20 69 66 20 61 | 20 67 69 76 65 6e 20 74 |see if a| given t|
|00006200| 72 61 70 20 69 73 20 69 | 6d 70 6c 65 6d 65 6e 74 |rap is i|mplement|
|00006210| 65 64 2e 20 54 68 69 73 | 20 69 73 20 6f 6e 6c 79 |ed. This| is only|
|00006220| 20 75 73 65 64 20 62 79 | 20 74 68 65 0d 09 49 6e | used by| the..In|
|00006230| 69 74 69 61 6c 69 7a 65 | 20 72 6f 75 74 69 6e 65 |itialize| routine|
|00006240| 20 69 6e 20 74 68 69 73 | 20 70 72 6f 67 72 61 6d | in this| program|
|00006250| 2c 20 73 6f 20 77 65 20 | 70 75 74 20 69 74 20 69 |, so we |put it i|
|00006260| 6e 20 74 68 65 20 49 6e | 69 74 69 61 6c 69 7a 65 |n the In|itialize|
|00006270| 20 73 65 67 6d 65 6e 74 | 2e 0d 09 54 68 65 20 72 | segment|...The r|
|00006280| 65 63 6f 6d 6d 65 6e 64 | 65 64 20 61 70 70 72 6f |ecommend|ed appro|
|00006290| 61 63 68 20 74 6f 20 73 | 65 65 20 69 66 20 61 20 |ach to s|ee if a |
|000062a0| 74 72 61 70 20 69 73 20 | 69 6d 70 6c 65 6d 65 6e |trap is |implemen|
|000062b0| 74 65 64 20 69 73 20 74 | 6f 20 73 65 65 20 69 66 |ted is t|o see if|
|000062c0| 0d 09 74 68 65 20 61 64 | 64 72 65 73 73 20 6f 66 |..the ad|dress of|
|000062d0| 20 74 68 65 20 74 72 61 | 70 20 72 6f 75 74 69 6e | the tra|p routin|
|000062e0| 65 20 69 73 20 74 68 65 | 20 73 61 6d 65 20 61 73 |e is the| same as|
|000062f0| 20 74 68 65 20 61 64 64 | 72 65 73 73 20 6f 66 20 | the add|ress of |
|00006300| 74 68 65 0d 09 55 6e 69 | 6d 70 6c 65 6d 65 6e 74 |the..Uni|mplement|
|00006310| 65 64 20 74 72 61 70 2e | 20 2a 2f 0d 0d 23 64 65 |ed trap.| */..#de|
|00006320| 66 69 6e 65 20 5f 5f 53 | 45 47 5f 5f 20 49 6e 69 |fine __S|EG__ Ini|
|00006330| 74 69 61 6c 69 7a 65 0d | 42 6f 6f 6c 65 61 6e 20 |tialize.|Boolean |
|00006340| 54 72 61 70 41 76 61 69 | 6c 61 62 6c 65 28 74 4e |TrapAvai|lable(tN|
|00006350| 75 6d 62 65 72 2c 74 54 | 79 70 65 29 0d 09 73 68 |umber,tT|ype)..sh|
|00006360| 6f 72 74 09 09 74 4e 75 | 6d 62 65 72 3b 0d 09 54 |ort..tNu|mber;..T|
|00006370| 72 61 70 54 79 70 65 09 | 74 54 79 70 65 3b 0d 7b |rapType.|tType;.{|
|00006380| 0d 09 2f 2a 20 43 68 65 | 63 6b 20 61 6e 64 20 73 |../* Che|ck and s|
|00006390| 65 65 20 69 66 20 74 68 | 65 20 74 72 61 70 20 65 |ee if th|e trap e|
|000063a0| 78 69 73 74 73 2e 20 4f | 6e 20 36 34 4b 20 52 4f |xists. O|n 64K RO|
|000063b0| 4d 20 6d 61 63 68 69 6e | 65 73 2c 20 74 54 79 70 |M machin|es, tTyp|
|000063c0| 65 20 77 69 6c 6c 20 62 | 65 20 69 67 6e 6f 72 65 |e will b|e ignore|
|000063d0| 64 2e 20 2a 2f 0d 0d 09 | 72 65 74 75 72 6e 20 4e |d. */...|return N|
|000063e0| 47 65 74 54 72 61 70 41 | 64 64 72 65 73 73 28 74 |GetTrapA|ddress(t|
|000063f0| 4e 75 6d 62 65 72 2c 20 | 74 54 79 70 65 29 20 21 |Number, |tType) !|
+--------+-------------------------+-------------------------+--------+--------+
Only 25.0 KB of data is shown above.